Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. function FindItem(item, cb) {
  2. var output = ' nada';
  3.  
  4. var itemName = '';
  5. var instructions = '';
  6. var whereItGoes = '';
  7.  
  8. //Get Item name and Instructions
  9. var options1 = { ... };
  10.  
  11. request(options1, function (error, response, body) {
  12. ...//Extracting Data here
  13.  
  14. var options2 = { ... };
  15.  
  16. //BTW: If you're wondering why I have a nested request, it's because I need to use an ID from the first request to get the right URL for this second request.
  17. request(options2, function (error, response, body) {
  18. ...//Extracting Data here
  19.  
  20. output = itemName + '. ' + instructions + ' ' + whereItGoes;//For now, I'll say (some string)
  21. console.log('Output #1 ' + output);
  22. });
  23. console.log('Output #2 ' + output);
  24. });
  25. console.log('Output #3 ' + output);
  26. };
  27.  
  28. Output #1 (some string)
  29. Output #2 (some string)
  30. Output #3 (some string)
  31.  
  32. Output #1 nada
  33. Output #2 nada
  34. Output #3 (some string)
  35.  
  36. //This is the template from JOVO
  37. app.setHandlet()({
  38. BindicatorIntent() {
  39. var response = 'wrong';
  40.  
  41. FindItem(this.$inputs.Item.value, function (output) {
  42. console.log('This is the output im getting: ' + output);
  43. response = output;
  44. });
  45.  
  46. this.ask(response);
  47. }
  48. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement