diff --git a/README.md b/README.md index 700b818..c3122ac 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ WelsonJS - Build a Windows desktop apps with JavaScript, HTML, and CSS based on ![Structure](app/assets/img/structure.png) ## Specifications -- ES6(ECMAScript 6, Optional), ES5(ECMAScript 5), JSON compatibility +- ES6(ECMAScript 6), ES5(ECMAScript 5), JSON compatibility - [github:es-shims/es5-shim](https://github.com/es-shims/es5-shim) - [github:paulmillr/es6-shim](https://github.com/paulmillr/es6-shim) - [github:bestiejs/json3](https://github.com/bestiejs/json3) diff --git a/app.js b/app.js index b146ddc..004c2aa 100644 --- a/app.js +++ b/app.js @@ -155,13 +155,12 @@ if (typeof(CreateObject) !== "function") { /** * @FN {string} The name of the file. - * @escapeToGlobal {bool} Specifies the scope of code to execute. */ -function _require(FN, escapeToGlobal) { +function require(FN) { var cache = require.__cache = require.__cache || {}; + var global = require.__global; if (FN.substr(FN.length - 3) !== '.js') FN += ".js"; if (cache[FN]) return cache[FN]; - if (typeof(escapeToGlobal) != "boolean") escapeToGlobal = true; // get directory name var getDirName = function(path) { @@ -201,13 +200,11 @@ function _require(FN, escapeToGlobal) { } // make function - if (!escapeToGlobal) { - T = "(function(global){var module=new ModuleObject();return(function(exports,require,module,__filename,__dirname){" - + '"use strict";' - + T - + "\n\nreturn module.exports})(module.exports,global.require,module,__filename,__dirname)})(this);\n\n////@ sourceURL=" - + FN; - } + T = "(function(global){var module=new ModuleObject();return(function(exports,require,module,__filename,__dirname){" + + '"use strict";' + + T + + "\n\nreturn module.exports})(module.exports,global.require,module,__filename,__dirname)})(global);\n\n////@ sourceURL=" + + FN; // execute function try { @@ -223,13 +220,7 @@ function _require(FN, escapeToGlobal) { return cache[FN]; } - -/** - * @FN {string} The name of the file. - */ -function require(FN) { - return _require(FN, false); -} +require.__global = this; ///////////////////////////////////////////////////////////////////////////////// // Load script, and call app.main() @@ -303,7 +294,7 @@ var ModuleObject = function() { //_require("app/assets/js/json2"); // JSON 3 was a JSON polyfill for older JavaScript platforms -_require("app/assets/js/json3-3.3.2.min"); +require("app/assets/js/json3-3.3.2.min"); // Babel Polyfill (7.12.1) require("app/assets/js/babel-polyfill-7.12.1.edited"); @@ -317,8 +308,8 @@ var squel = require("app/assets/js/squel-basic-5.13.0.hiddentao-afa1cb5.edited") // (Optional) // ECMAScript 6 compatibility shims for legacy JS engines -//require("app/assets/js/es6-shim-0.35.6.ljharb-62dbad5"); -//require("app/assets/js/es6-sham.0.35.6.ljharb-62dbad5"); +require("app/assets/js/es6-shim-0.35.6.ljharb-62dbad5.edited"); +require("app/assets/js/es6-sham.0.35.6.ljharb-62dbad5"); // Dive into entrypoint function main() { diff --git a/app/assets/js/es6-shim-0.35.6.ljharb-62dbad5.js b/app/assets/js/es6-shim-0.35.6.ljharb-62dbad5.edited.js similarity index 99% rename from app/assets/js/es6-shim-0.35.6.ljharb-62dbad5.js rename to app/assets/js/es6-shim-0.35.6.ljharb-62dbad5.edited.js index a754b81..8f0cdb7 100644 --- a/app/assets/js/es6-shim-0.35.6.ljharb-62dbad5.js +++ b/app/assets/js/es6-shim-0.35.6.ljharb-62dbad5.edited.js @@ -69,7 +69,7 @@ var _some = Function.call.bind(Array.prototype.some); var defineProperty = function (object, name, value, force) { - if (!force && name in object) { return; } + if (!object || (!force && name in object)) { return; } if (supportsDescriptors) { Object.defineProperty(object, name, { configurable: true, diff --git a/app/assets/js/webreflection-ie8-0.8.1.min.js b/app/assets/js/ie8-0.8.1.min.js similarity index 100% rename from app/assets/js/webreflection-ie8-0.8.1.min.js rename to app/assets/js/ie8-0.8.1.min.js diff --git a/lib/oldbrowser.js b/lib/oldbrowser.js index 1875745..5f560d4 100644 --- a/lib/oldbrowser.js +++ b/lib/oldbrowser.js @@ -198,7 +198,7 @@ exports.start = function(callback) { // load jQuery and cross browsing libraries if (IEVersion == 8) { - exports.addScript("app/assets/css/jquery/webreflection-ie8-0.8.1.min.js"); + exports.addScript("app/assets/css/jquery/ie8-0.8.1.min.js"); } exports.addScript("app/assets/js/html5shiv-printshiv-3.7.3.min.js"); if (IEVersion < 9) {