Last active
September 27, 2017 06:39
-
-
Save jjrv/d79461c69c94c742cb1442eb5fb58df2 to your computer and use it in GitHub Desktop.
This file contains 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 characters
System.config({ | |
transpiler: false, | |
map: { | |
dstore: 'node_modules/dojo-dstore', | |
css: 'node_modules/systemjs-plugin-css/css.js' | |
}, | |
packages: { | |
'node_modules/dojo/': { | |
defaultExtension: 'js', | |
meta: { | |
'*.js': { loader: 'dojoLoader' } | |
} | |
}, | |
'node_modules/dojo-dstore/': { | |
defaultExtension: 'js', | |
meta: { | |
'*.js': { loader: 'dojoLoader' } | |
} | |
}, | |
'node_modules/dgrid/': { | |
defaultExtension: 'js', | |
meta: { | |
'*.js': { loader: 'dojoLoader' } | |
} | |
} | |
} | |
}); |
This file contains 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 characters
// This is a minimal shim for loading Dojo using SystemJS. | |
exports = { | |
translate: function(spec, foo) { | |
if(this.builder) { | |
const config = { | |
'touch': true, | |
'config-deferredInstrumentation': false, | |
'dom-addeventlistener': true, | |
'host-browser': true | |
}; | |
// These kludges support enough AMD loader syntax to make dgrid work. | |
// Map "has!condition?yes:no" tests using condition values listed above. | |
spec.source = spec.source.replace(/(['"])[^'"]+\/has!([^?'"]*)\?([^:'"]*):?([^'"]*)/g, function(match, quote, condition, yes, no) { | |
return(quote + ((config[condition] ? yes : no) || 'undefined')); | |
// Map "selector/loader!default" to "selector/lite.js". | |
}).replace(/(['"][^'"]+\/selector\/)_loader!([^'"]*)/, function(match, prefix) { | |
return(prefix + 'lite.js'); | |
}).replace(/['"]require['"]/, '"dojoRequire"'); | |
} | |
}, | |
fetch: function(spec, fetch) { | |
const name = spec.name.replace(System.baseURL, ''); | |
if(typeof(require) == 'function' && require.cache) { | |
// Dojo require function was found. | |
return(new Promise(function(resolve) { | |
require([ name ], function(module) { | |
spec.dojo = module; | |
resolve(''); | |
}); | |
})); | |
} else if(this.builder) { | |
// systemjs-builder support. | |
return(fetch(spec)); | |
} | |
}, | |
instantiate: function(spec, instantiate) { | |
return(spec.dojo); | |
} | |
}; |
This file contains 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 characters
module.exports = { toUrl: function(url) { return('node_modules/dojo/' + url); } }; |
This file contains 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 characters
<!doctype html> | |
<html><head> | |
<title>Test</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<script type="text/javascript"> | |
// Configure Dojo loader. | |
var dojoConfig = { | |
async: true, | |
baseUrl: 'node_modules', | |
packages: [ | |
{ name: 'dojo', location: 'dojo' }, | |
{ name: 'dgrid', location: 'dgrid' }, | |
{ name: 'dstore', location: 'dojo-dstore' } | |
] | |
} | |
</script> | |
<script defer src="node_modules/systemjs/dist/system.js" type="text/javascript"></script> | |
<script defer src="config.js"></script> | |
<script defer src="http://download.dojotoolkit.org/release-1.12.2/dojo.js"></script> | |
</head> | |
<body></body> | |
</html> |
This file contains 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 characters
module.exports = undefined; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment