I’m having problems adapting a command to work well with 0.1.9 and
0.5.   I’m using parseVersion, but in 0.5 the ‘execute’ function
apparently expects the same form of argument regardless of whether the
value of extensions.ubiquity.parserVersion is 1 or 2.  So for example
assume a simple command expecting only an object argument for which
the ‘data’ property set by the _suggest function:

If in 0.1.9 one used:

      execute: function( {data} ) {
          // do something with ‘data’
      },

in 0.5 with parser 2 one could do the following (this works fine)

      execute: function( {object} ) {
          // do something with ‘object.data’
      },

However, the following hybrid approach does not work in 0.5 if
extensions.ubiquity.parserVersion is set to 1:

      execute: function( {object} ) {
          var data = (CmdUtils.parserVersion == 2) ? object.data :
object;
          // do something with ‘data’
      },

Could you please confirm this, or am I doing something else
fundamentally wrong?


Note: in order to use the same version of execute for parser 1 an 2,
I’m setting passing CmdUtils.CreateCommand a object combining the
arguments formats expected by parser 1 and 2:

      name:     "foo",   /* parser1 */
      names:   ["foo"],  /* parser2 */
      author:  (CmdUtils.parserVersion == 2)? {name: "esquifit"}  /*
parser2 */
                                                               :
"esquifit",           /* parser1 */
      takes:     {"Foo command": noun_type_gmCommand },    /* parser1
*/
      arguments: [ {label: " Foo command",                            /
* parser2 */
                        nountype: noun_type_fooCommand,
                        role: "object"}
                 ],
      description: "Sample foo command",

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to