canmove, Confirmed users
2,056
edits
(update docs to the latest version of the module and point to the new canonical location of the module) |
(the URI module) |
||
Line 114: | Line 114: | ||
testBranch.set({ foo: 1, bar: "awesome", baz: true }); | testBranch.set({ foo: 1, bar: "awesome", baz: true }); | ||
== URI == | |||
The [http://hg.mozdev.org/jsmodules/file/tip/URI.js URI module] creates [http://mxr.mozilla.org/mozilla/source/netwerk/base/public/nsIURI.idl nsIURI] objects from location strings. It wraps [http://mxr.mozilla.org/mozilla/source/netwerk/base/public/nsIIOService.idl nsIIOService]::newURI. There are two ways to use it. First, you can call it as a constructor: | |||
new URI(spec, charset, baseURI); | |||
Second, you can call its <tt>get</tt> method: | |||
URI.get(spec, charset, baseURI); | |||
In both cases, the parameters are the same, and only the <tt>spec</tt> parameter is required; the <tt>charset</tt> and <tt>baseURI</tt> parameters are optional. The difference between these two techniques is that the constructor throws an error if you pass it an invalid spec, while the <tt>get</tt> method returns null in that case. | |||
In the future, the URI module may return JavaScript URI objects implementing a different interface than nsIURI. |