Last active
May 9, 2018 16:54
-
-
Save shrutis22/048b15b8bb1f5165c25accc10d69f126 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
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