Last active
April 11, 2016 21:20
-
-
Save mduleone/caede5f4dddb2b62649441e77c6931d6 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
function intentHandler (session, other, stuff, callback) { | |
// some random stuff... | |
request.post({options: "duh",}, {body: "duh",}, function (e0, r0, b0) { | |
// Now you know that post has returned, do the get stuff you needed | |
request.get({otherOptions: "duh",}, function (e1, r1, b1) { | |
// Now you know that get has returned, do the stuff you need. | |
callback( | |
sessionAttributes, | |
buildSpeechletResponseCard( | |
cardTitle, | |
speechOutput, | |
cardOutput, | |
repromptText, | |
shouldEndSession | |
) | |
); | |
}); | |
}); | |
} |
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
makePost(callback) { | |
request.post(options, body, function(e, r, b) { | |
callback(e, r, b); | |
}); | |
} | |
function intentHandlerWithPost (session, other, stuff, callback) { | |
makePost(function(e, r, b) { | |
// Now you know that post has returned, do the get stuff you needed | |
request.get({otherOptions: "duh",}, function (e1, r1, b1) { | |
// Now you know that get has returned, do the stuff you need. | |
callback( | |
sessionAttributes, | |
buildSpeechletResponseCard( | |
cardTitle, | |
speechOutput, | |
cardOutput, | |
repromptText, | |
shouldEndSession | |
) | |
); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment