Labs/Ubiquity/Parser 2 API Conversion Tutorial: Difference between revisions

no edit summary
No edit summary
Line 25: Line 25:
There is a property added to the Command API that allows you to present different commands to clients running Parser 1 and Parser 2, called CmdUtils.parserVersion.  A command can provide different options to CmdUtils.CreateCommand() and behave differently depending on this value, allowing a single command feed to cater to whatever parser the user is using.  
There is a property added to the Command API that allows you to present different commands to clients running Parser 1 and Parser 2, called CmdUtils.parserVersion.  A command can provide different options to CmdUtils.CreateCommand() and behave differently depending on this value, allowing a single command feed to cater to whatever parser the user is using.  


   if (CmdUtils.parserVersion == 2)
   if (CmdUtils.parserVersion == 2) {
     //parser 2 command here
     //parser 2 command here
   else
   } else {
     //parser 1 command here
     //parser 1 command here
  }


== Converting your command ==
== Converting your command ==
19

edits