0
我在我的Firefox插件中有一个main.js
文件,它需要在另一个文件中定义的类,然后添加一个工具栏项。从不是main.js的文件访问小部件实例?
// lib/main.js
var widgets = require('widgets'),
disabler = require('./disabler');
var toolbarOptions = {
id: 'the-id',
label: 'The Widget',
contentURL: self.data.url('icon-16.png')
};
// Add the toolbar item to the browser. Because this is a CommonJS environment,
// this reference to the toolbar is locally scoped.
var toolbar = widgets.Widget(toolbarOptions);
我想这样做是工具栏的contentURL
从disabler
更改文件中。但是,我无法访问该文件中的toolbar
变量。
如何从disabler
访问toolbar
?
顺便说一下,我使用的是附加SDK的版本1.10。