从暂存器访问Add-on SDK模块 [英] Access Add-on SDK module from the scratchpad

查看:144
本文介绍了从暂存器访问Add-on SDK模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用暂存器测试附加代码的小片段。在这种情况下,我试图访问通知模块,如下所示:

  const {notify} = require(sdk /通知); 
notify({
//我的通知的选项
});

正如所料,我得到错误 Exception:require is not defined 。由于附件SDK与Firefox打包在一起,所以我想知道是否有方法直接从暂存器访问模块。感谢。




编辑:Google搜索后,发现 scratch-kit(github),这个插件正是我正在做的事情。但是不幸的是 ,所以我提交了一个bug ,希望这个功能会被添加到devtools中。

解决方案

目前没有办法做到这一点。一些事情可能会发生,使人们可以观看/贡献的可能性:


  1. scratch-kit 已更新

  2. native jetpack 已经完成并与itchpad集成(应该替换scratch kit)。 我做了一个我写博客的例子,但它尚未准备好发布


I'd like to test small snippets of my add-on code using the scratchpad. In this case, I'm trying to access the notifications module like so:

const { notify } = require("sdk/notifications");
notify({
  //My notification's options
}); 

As expected, I get the error Exception: require is not defined. As the Add-on SDK is packaged with Firefox, I'm wondering if there's a way to access the modules directly from the scratchpad. Thanks.


Edit: After some Googling, I found scratch-kit (github), an add-on that does exactly what I'm trying to do. But it is unfortunately broken, so I've filed a bug in hopes that this functionality will be added to the devtools.

解决方案

At the moment there isn't a way to do this. A few things could happen to make this possible which people can watch/contribute:

  1. scratch-kit is updated
  2. native jetpack is completed and is integrated with itchpad (which should replace scratch kit). I made an example which I blogged about but it's not ready for release yet.

这篇关于从暂存器访问Add-on SDK模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆