0
我想写香草的JavaScript插件属性“窗口”,但越来越以下错误:JavaScript的插件 - 无法读取的不确定
cannot read property 'window' of undefined
这是我的代码:
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory(root));
} else if (typeof exports === 'object') {
module.exports = factory(root);
} else {
root.myPlugin = factory(root);
}
})(typeof global !== "undefined" ? global : this.window || this.global, function (root) {
'use strict';
...
[请参阅'this' MDN]中的此部分(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#Simple_call) –