Created
September 10, 2012 17:19
-
-
Save mockee/3692265 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
// 支持自定义命名空间 | |
Do.setConfig('namespace', 'Ark'); | |
// 利用 `Do` 自身的 `add` 来定义模块的方法名 | |
Do.add('cookie', { path: 'cookie.js' }); | |
Do.add('ajax', { path: 'ajax.js', requires:['cookie'] }); | |
Do('ajax', function() { | |
console.info(Ark.ajax); // Using ajax with cookie mod. | |
}); | |
// cookie module | |
define('mods/cookie', function() { | |
return function() { | |
return 'cookie mod'; | |
}; | |
}); | |
// ajax module | |
define('mods/ajax', ['mods/cookie'], function(cookie) { | |
return function() { | |
return 'Using ajax with ' + cookie(); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment