Work with modules that assign to exports

CommonJS style modules will either assign `exports` to `module` or will assign properties to `exports`.  This allows us to work with either style:

    module.exports = Foo;

or

    exports.Foo = Foo;

Support for additional properties that are assigned to `exports` (or non-function values assigned to `module.exports`) will likely take additional typedef work in the wrapper.
This commit is contained in:
Tim Schaub
2014-10-24 08:45:59 -06:00
parent 120ace5cef
commit c6b172aef2

View File

@@ -40,7 +40,8 @@ function wrapModule(mod, callback) {
'/** @typedef {function(*)} */\n' +
'ol.ext.' + mod.name + ';\n' +
'(function() {\n' +
'var module = {};\n' +
'var exports = {};\n' +
'var module = {exports: exports};\n' +
'/**\n' +
' * @fileoverview\n' +
' * @suppress {accessControls, ambiguousFunctionDecl, ' +