Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
({
showEmotion : function(component, event, helper) {
var toneAnalyzeResponse = component.get( "v.toneAnalyzeResponse" );
var standardTones = [ "joy", "sadness", "anger", "fear" ];
var emotion;
for( var i = 0; i <= standardTones.length - 1; i++ ) {
if( toneAnalyzeResponse.indexOf( standardTones[i] ) !== -1 ) {
emotion = standardTones[i];
break;
}
}
helper.getGiphyImage(
emotion,
function( gifUrl ) {
component.set( "v.gifUrl", gifUrl );
component.set( "v.detectedEmotion", emotion );
}
);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment