micro-definition
(<2kb) A lite module loader and cache module in localStorage.
Try it now
Getting started
$ npm install micro-definition
Dependency
How to use
#Define a module
Define( id : String, method : Function )
Define('mod', function () {
return value;
});
#Define a module with dependencies
Define( id : String, dependency : Array, method : Function )
Define('mod-a', ['mod-b', 'mod-c'], function ( b, c ) {
return value;
});
#Require modules
Define( dependency : Array, callback : Function )
Define(['jQuery', 'lodash'], function ( $, _ ) {
});
#Config of alias
Define.alias( alias : Object )
Define.alias({
'mod-a' : 'a.js',
'mod-b' : 'b.js',
});
#Show all defined modules
More Define.storage
api see micro-storage.
Define.storage.list();
#Remove a defined module
More Define.storage
api see micro-storage.
Define.storage.remove('mod-a');
License
MIT