jsHint在自调用函数结束时使用标准模块模式生成错误,我传入参数:}(window.document, jQuery))
任何人都知道为什么?
var kaApp = (function (document, $) {
'use strict';
var testStrict = {p1:10, p2:15, p3:20};
// x = 3;
var docElem = document.documentElement;
console.log(testStrict);
if(foo === undefined){
var foo = 'foobar';
}
var setUserAgentString = function userAgent() {
docElem.setAttribute('data-useragent', navigator.userAgent);
};
console.log('userAgentInit name: ' + setUserAgentString.name);
return {
init: function() {
setUserAgentString();
$(document).ready(this.afterDomReady);
},
afterDomReady: function() {
// Executes after DOM ready
console.log('----- DOM is ready!!!!');
}
};
}(window.document, jQuery)); // error here "missing 'use strict' statement"
kaApp.init(document, jQuery);