简体   繁体   English

如何使用jpm将index.js以外的文件添加到Firefox加载项

[英]How to add a file other than index.js to a Firefox add-on using jpm

I am building a Firefox add-on and like to include code that is used in the index.js, as well as in the worker script. 我正在构建一个Firefox附加组件,并且喜欢包含在index.js和worker脚本中使用的代码。 Instead of copying the function, I would like to add it in a file next to the index.js if possible. 如果可能的话,我想将它添加到index.js旁边的文件中,而不是复制函数。

for addon modules you use require("./relative/path.js") , for the worker you specify it through the contentScriptFile parameter. 对于您通过contentScriptFile参数指定它的worker所使用的addon模块(“./ relative / path.js”) You will have to feature-detect whether CommonJS features (require/exports) are available. 您必须使用功能检测CommonJS功能(需要/导出)是否可用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 `jpm run` 用于 Firefox Add-on SDK 扩展时,如何将数据持久存储在 `localStorage` 中 - How to persistently store data in `localStorage` when using `jpm run` for a Firefox Add-on SDK extension 使用jpm run测试Firefox附加SDK扩展时如何启用调试 - How to enable debuging when using jpm run to test a Firefox Add-on SDK extension Firefox加载项可与“ jpm run”一起使用,但不能与“ jpm xpi”生成的.xpi文件一起使用 - Firefox add-on works with “jpm run”, but not whith .xpi file generated with “jpm xpi” 如何知道Firefox Add-on SDK中其他加载项的安装 - How to know the installation of other add-on in Firefox Add-on SDK 使用jpm向Firefox扩展添加第二个按钮 - Add a second button to a Firefox extension using jpm 如果主 js 文件从其他 js 文件导入内容,则 Firefox 附加组件不起作用 - Firefox add-on not working if the main js file imports stuff from other js files Firefox附加组件,用于向页面添加.css和.js文件 - Firefox add-on to add a .css and a .js file to a page Firefox 附加组件:1) 将 Python 脚本链接到附加组件主代码 | 2) JPM / NPM 中的 win32 api | 3) 使用 OS.file 在 Windows 中设置文件属性 - Firefox add-ons: 1) Linking Python script to add-on main code | 2) win32 api in JPM / NPM | 3) set file attributes in Windows with OS.file 每次我改变我正在开发的Firefox插件时,我是否必须使用`jpm run`? - Do I have to use `jpm run` every time I change the Firefox add-on I'm developing? 使用 --profile 参数集运行 jpm 时不会安装 Firefox 附加组件 - Firefox Add-on does not install when running jpm with --profile argument set
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM