Permalink
Browse files

feat: add support of dumber-module-loader

  • Loading branch information...
huochunpeng committed Jan 13, 2019
1 parent a950e5f commit 1d9433f8fceff46d454b80ca6574a1db724cfc54
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/index.js
@@ -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;

0 comments on commit 1d9433f

Please sign in to comment.