Skip to content

Commit

Permalink
feat: add support of dumber-module-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
3cp committed Jan 13, 2019
1 parent a950e5f commit 1d9433f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,22 @@ PLATFORM.Loader = DefaultLoader;

if (!PLATFORM.global.System || !PLATFORM.global.System.import) {
if (PLATFORM.global.requirejs) {
let defined;
let getDefined;
if (typeof PLATFORM.global.requirejs.s === 'object') {
// Support for requirejs/requirejs
defined = PLATFORM.global.requirejs.s.contexts._.defined;
getDefined = () => PLATFORM.global.requirejs.s.contexts._.defined;
} else if (typeof PLATFORM.global.requirejs.contexts === 'object') {
// Support for requirejs/alameda
defined = PLATFORM.global.requirejs.contexts._.defined;
getDefined = () => PLATFORM.global.requirejs.contexts._.defined;
} else if (typeof PLATFORM.global.requirejs.definedValues === 'function') {
// Support for dumberjs/dumber-module-loader
getDefined = () => PLATFORM.global.requirejs.definedValues();
} else {
// skip any unknown AMD loader
defined = {};
getDefined = () => ({});
}
PLATFORM.eachModule = function(callback) {
const defined = getDefined();
for (let key in defined) {
try {
if (callback(key, defined[key])) return;
Expand Down

0 comments on commit 1d9433f

Please sign in to comment.