Changes

Jump to: navigation, search

Labs/Ubiquity/Ubiquity 0.1 Author Tutorial

693 bytes added, 16:34, 10 March 2009
Introduction to Noun Types: added section on regular expressions
Once you are familiar with writing commands, you should check out the [http://hg.toolness.com/ubiquity-firefox/file/6caa9d66b3bb/ubiquity/chrome/content/nlparser/en/nountypes.js nountypes.js], which has the implementation for most of the noun-types. You can see what noun types are already available for your commands to use, what still needs to be written, and where the existing implementations could use improvement — and then come [[Labs/Ubiquity#Participation|get involved]] to help us improve them.
 
==== For Those Who Like Regular Expressions... ====
 
If you're a fan of [https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Regular_Expressions regular expressions], as of Ubiquity 0.1.7 you can just put a regular expression in place of a noun type object, and Ubiquity will take care of the rest. Make sure you specify the regular expression as either a regular expression literal or a [https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp RegExp] object.
 
For example:
 
<pre>
CmdUtils.CreateCommand({
name: "digits",
takes: {"some digits": /[0-9]+/},
execute: function(digits) {
displayMessage("You entered " + digits.text);
}
});
</pre>
== Insert Email: Commands with Specific Argument Types ==
874
edits

Navigation menu