Skip to content

micro-app/micro-definition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm npm npm bitHound Code

micro-definition

(<2kb) A lite module loader and cache module in localStorage.

Try it now

Getting started

$ npm install --save-dev micro-definition

Dependency

How to use

#Define a module

Define( id : String, method : Function )

Define('mod', function () {
    // some code;
    return value;
});

#Define a module with dependencies

Define( id : String, dependency : Array, method : Function )

Define('mod-a', ['mod-b', 'mod-c'], function ( b, c ) {
    // some code;
    return value;
});

#Require modules

Define( dependency : Array, callback : Function )

Define(['jQuery', 'lodash'], function ( $, _ ) {
    // some code;
});

#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

About

(<2kb) A lite module definition tool.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published