adding new dryice build files
This commit is contained in:
parent
d984ebbec4
commit
da32d7dc36
2 changed files with 1136 additions and 0 deletions
1087
Makefile.dryice.js
Normal file
1087
Makefile.dryice.js
Normal file
File diff suppressed because it is too large
Load diff
49
demo/mini_require.js
Normal file
49
demo/mini_require.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
|
||||
function require(module, callback) {
|
||||
|
||||
if (Array.isArray(module)) {
|
||||
var params = [];
|
||||
module.forEach(function(m) {
|
||||
params.push(require.modules[m]);
|
||||
}, this);
|
||||
|
||||
if (callback) {
|
||||
callback.apply(null, params);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof module === 'string') {
|
||||
var payload = require.modules[module];
|
||||
if (payload == null) {
|
||||
console.error('Missing module: ' + module);
|
||||
}
|
||||
|
||||
if (typeof payload === 'function') {
|
||||
var exports = {};
|
||||
var module = {
|
||||
id: '',
|
||||
uri: ''
|
||||
};
|
||||
payload(require, exports, module);
|
||||
payload = exports;
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
return payload;
|
||||
}
|
||||
}
|
||||
require.modules = {};
|
||||
|
||||
function define(module, payload) {
|
||||
if (typeof module !== 'string') {
|
||||
console.error('dropping module because define wasn\'t munged.');
|
||||
console.trace();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('defining module: ' + module + ' as a ' + typeof payload);
|
||||
require.modules[module] = payload;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue