-
-
Save beginor/7dbe633ef26e98fe0ba70bcb1d191b8c to your computer and use it in GitHub Desktop.
Revisions
-
beginor renamed this gist
Feb 17, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
beginor revised this gist
Feb 17, 2017 . 1 changed file with 31 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,23 +1,34 @@ exports.fetch = function(load) { var name = load.name; return new Promise(function(resolve) { var dojoName = convertToDojoModule(name); window.require([dojoName], function(mod) { SystemJS.register(dojoName, [], function (exp, idObj) { return { setters: [], execute: function() { exp("default", mod); } }; }); resolve(''); }); }); }; exports.instantiate = function (load) { var name = load.name.split('!')[0]; var dojoName = convertToDojoModule(name); return new Promise(function (resolve) { // Since module is loaded by fetch, just require it again, // dojo require does not load the module again. window.require([dojoName], function (module) { resolve(module); }); }); }; function convertToDojoModule(module) { // we just replace SystemJS.baseURL with ''; return module.replace(SystemJS.baseURL, ''); } -
green3g revised this gist
Aug 30, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ exports = { return new Promise(function(resolve) { //use dojo's require and then register the module window.require([module], function(mod) { System.register(module, [], function(exp, idObj) { var result = { setters: [], execute: function() { -
green3g created this gist
Aug 30, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ exports = { fetch: function(load, fetch) { console.log('load', load); let module = load.name.split('!')[0]; return new Promise(function(resolve) { //use dojo's require and then register the module window.require([module], function(mod) { System.register(names[i], [], function(exp, idObj) { var result = { setters: [], execute: function() { //Make the name 'default' here as there is only one export per module so it is technically the default. //Import using a default import statement - eg: import Map from 'esri/Map' //It's possible this may only compile using 'system' module type in some IDEs using the official typings file though. exp("default", mod); } }; return result; }); }); }); } };