I have several very similar commands. So I'd like to make a base
command with shared functionality, and the rest of commands should
“inherit” from it.
Test code:
var MyCommands = {};
MyCommands['stub-command'] = {
author: {
name: "Eugene Janusov",
email: "[email protected]"
},
preview: function(pblock, directObject) {
displayMessage('::: ' + this.test());
},
execute: function(directObject) {},
test: function() {
return '[' + this.name + '] [' + this.author.name + ']';
}
};
MyCommands['test-command'] = jQuery.extend({}, MyCommands['stub-
command'], {
name: 'test-command'
});
CmdUtils.CreateCommand(MyCommands['test-command']);
displayMessage('::: ' + MyCommands['test-command'].test());
MyCommands['test-command'].preview();
The last two lines work perfectly, display
::: [test-commands] [Eugene Janusov]
>>> [test-commands] [Eugene Janusov]
But as soon as I start to use `test-command', I get the following
message:
>>> [] [Eugene Janusov]
Seems like Ubiquity calls preview() in some special context.
Is there any way to “extend” commands?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---