canmove, Confirmed users
2,056
edits
(document the new JSON module) |
(update documentation of JSON module now that it supports all Gecko 1.9.0 applications) |
||
Line 14: | Line 14: | ||
== JSON == | == JSON == | ||
The [http://hg.mozdev.org/jsmodules/file/tip/JSON.js JSON module] wraps the incompatible Firefox 3.0 and 3.5 JSON APIs, presenting the | The [http://hg.mozdev.org/jsmodules/file/tip/JSON.js JSON module] wraps the incompatible Gecko 1.9.0 (Firefox 3.0) and Gecko 1.9.1 (Firefox 3.5) JSON APIs, presenting the Gecko 1.9.1 API on both versions, for extensions that support multiple versions of Gecko-based applications. | ||
Note: don't import this into the global namespace! If you do, you'll hork native | Import this module into your extension to parse and stringify JSON in both Firefox 3.0 and 3.5 (and other Gecko-based applications, like Thunderbird) without checking the application's version each time. | ||
Note: don't import this into the global namespace! If you do, you'll hork native application code that expects the 1.9.0 API. Instead, import it into your own object like this: | |||
let MyExtension = { | let MyExtension = { | ||
Line 23: | Line 25: | ||
}; | }; | ||
Components.utils.import("chrome://myextension/modules/JSON.js", MyExtension); | Components.utils.import("chrome://myextension/modules/JSON.js", MyExtension); | ||
// Now MyExtension.JSON is an object implementing the | // Now MyExtension.JSON is an object implementing the Gecko 1.9.1 JSON API. | ||
The Firefox 3.5 JSON API is documented in the article [https://developer.mozilla.org/En/Using_JSON_in_Firefox Using JSON in Firefox]. | The Gecko 1.9.1 (Firefox 3.5) JSON API is documented in the article [https://developer.mozilla.org/En/Using_JSON_in_Firefox Using JSON in Firefox]. | ||
== Logging == | == Logging == |