- 
                Notifications
    You must be signed in to change notification settings 
- Fork 365
Open
Description
I am running on Artyom.window.min.js v1.0.6 and I am trying to use newPrompt with this following example:
function startPrompt()
{
  artyom.newPrompt({
      question:"How many centimeters should I cut?",
      //We set the smart property to true to accept wildcards
      smart:true,
      options:["Cut * centimeters","Remove * centimeters"],
      beforePrompt: () => {
          console.log("Before ask");
      },
      onStartPrompt:  () => {
          console.log("The prompt is being executed");
      },
      onEndPrompt: () => {
          console.log("The prompt has been executed succesfully");
      },
      onMatch: (i,wildcard) => {// i returns the index of the given options
          var action;
  
          var totalCentimeters = parseInt(wildcard);
  
          action = () => {
              alert(wildcard + " centimeters will be removed of your sandwich!");
          };
  
          // A function needs to be returned in onMatch event
          // in order to accomplish what you want to execute
          return action;                       
      }
  });
}When I run that startPrompt() function above, in the console, I see the onStartPrompt, onEndPrompt, but it returns instantly without the onMatch prompt. It never waited for the user to speak the centimeters before it closed. I don't know what is causing it to end prematurely without waiting for a reply.
I am using Google Chrome v70. Here is how I initialized Artyom:
  artyom.initialize({
	  lang:"en-GB",
	  //Listen Forever
	  continuous:true,
	  // Log everything in the console
	  debug:true,
	  // Keyword used to end a command forcefully
	  executionKeyword: "now",
	  // Initialize artyom !
	  listen:true,
	  soundex: true,
	  name: "vox"
  });Can someone please help? Thanks!
Metadata
Metadata
Assignees
Labels
No labels