Flip Flop
Just Another IOC Library
This Package is Deprecated, please use @flipflop/core and @flipflop/node packages
Thanks to everyone that tried out flip flop. This package wasn't browser friendly so I've decided to break out the dependency injection code from the node-centric stuff for better modularity and clarity. Tentatively there will be a @flipflop/core module and a @flipflop/node module. @flipflop/browser and @flipflop/server modules are on the roadmap as well but may not see the light of day for a while.
flip-flop is just another ioc library
*
in progress
Install
npm install --save flip-flop
Usage
Tell flipflop where your dependencies are
let flipflop = ; ;
flipflop loads your files and takes care of supplying your (a)sync dependencies when they're ready.
Just export a function in your js files
module{ }
return an A+ compliant thenable (a promise) if your module has to do some async stuff
module{ app ; });}
Why?
let email = ;
That's why.
You can probably come up with a glob to match all of your project files in a few seconds so just tell flip-flop what you want and stop worrying about where your code is.
Features
Asyncronous Dependencies
As long as your module constructor returns an A+ compliant thenable then any modules that depend on it won't load until it resolves.
log.txt
This is useful log output
a.js
module{ ;};
b.js
module{ ;};
Returning anything but a promise lets flip-flop know that your module is ready right away.
Collections
With flip-flop you register and depend on collections. This is useful when you want to create multiple modules that share something in common
server.js
module{ ;};
controller1.js
module{ };
controller2.js
module{ };
API
flipflop(String) | FlipFlop
Pass a file glob to flipflop which matches all of the files you wish to load. A FlipFlop instance will be returned with methods for loading your files and configuring your settings
const flipflop = ;const fl = ;
flipflop(Array) | FlipFlop
Pass an array of file globs to flipflop which matches all of the files you wish to load. A FlipFlop instance will be returned with methods for loading your files and configuring your settings
const flipflop = ;const fl = ;
flipflop uses glob-all to parse your globs
[FlipFlop].options(Object) | [FlipFlop]
TODO
- Better Reject() logic
- Write Tests
- Make it Global
- Support for a config file instead of options
- Travis
- Coveralls See See