canmove, Confirmed users
737
edits
| Line 217: | Line 217: | ||
'''Can I use other CommonJS modules like node.js in my add-on? ''' | '''Can I use other CommonJS modules like node.js in my add-on? ''' | ||
Not yet, although we plan to add this ability | Not yet, although we plan to add this ability. | ||
'''Can I use Add-on SDK / Add-on Builder modules in a traditional XUL extension? ''' | '''Can I use Add-on SDK / Add-on Builder modules in a traditional XUL extension? ''' | ||
Not | Not yet, although we plan to add this ability. | ||
'''Is there a Socket API in the Add-on SDK? ''' | '''Is there a Socket API in the Add-on SDK? ''' | ||
| Line 229: | Line 229: | ||
'''What's the local path on disk for my add-on's data directory? ''' | '''What's the local path on disk for my add-on's data directory? ''' | ||
The add-on's <code>data</code> directory does not map to a particular location on disk. The <code>require("self").data.url(name)</code> function will give you a URL that's usable from within the addon itself (e.g. as a content script). | |||
The <code>require("self").data.url(name)</code> function will give you a URL that's usable from within the addon itself (e.g. as a content | |||
'''How can I read from/write to a file? ''' | '''How can I read from/write to a file? ''' | ||
You can use the | You can use the [https://addons.mozilla.org/en-US/developers/docs/sdk/latest/packages/api-utils/docs/file.html <code>file</code>] module. However, if you just need some persistent storage and don't need the data to be available outside your add-on, you can use the [https://addons.mozilla.org/en-US/developers/docs/sdk/latest/packages/addon-kit/docs/simple-storage.html <code>simple-storage</code> module. | ||
'''How can I access data from my add-on's 'package.json' file, such as my add-on's name or version number? ''' | '''How can I access data from my add-on's 'package.json' file, such as my add-on's name or version number? ''' | ||
Use the [https://addons.mozilla.org/en-US/developers/docs/sdk/latest/packages/addon-kit/docs/self.html <code>self</code> module. | |||
'''How can I debug my add-on? ''' | '''How can I debug my add-on? ''' | ||
| Line 252: | Line 250: | ||
'''How can I localize strings appearing in my add-on? ''' | '''How can I localize strings appearing in my add-on? ''' | ||
The 1.5 release of the SDK delivers the first stage of support for localization. See the [https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/addon-development/l10n.html tutorial]. Note that at the moment you can only localize strings appearing in code, not strings inside HTML content. | |||