javascript - Import shared code between Firefox addon and Chrome addon into Firefox -


i developing firefox addon has chrome counterpart. eliminate code duplication there javascript libraries share in common. libraries not written commonjs design firefox jetpack modules expect. there way import , use shared javascript firefox modules?

preferably shared code can sit in directory in root directory, shared library has own rich directory structure , don't want stuff data or lib directory.

it's easy make js file loadable via commonjs, need add functions needed properties exports object, like:

function foo() {} function bar() {}  if (exports !== void 0) {   exports.foo = foo;   exports.bar = bar; } 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -