li

light-ioc

Simple Inversion of Control module from my NodeJS Framework.

Showing:

Popularity

Downloads/wk

2

GitHub Stars

2

Maintenance

Last Commit

5yrs ago

Contributors

2

Package

Dependencies

0

Size (min+gzip)

1.0KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

light-IOC

Simple Inversion of Control module from my NodeJS Framework.

This library works with any project based on JavaScript, both web and server.

About

We present a class and module version using vanilla javascript and typescript.

Examples

// var IOC = require("light-ioc");
// Create IOC and save values
var ioc = new IOC();
ioc.$set("var1", "mr sandman");
ioc.$set("var2", 12*5);
ioc.$set("var3", "hello");
ioc.$set("var4", "*****");

// Call ioc methods
try {
    // Inject values name from function arguments
    ioc.$call(function(var1, var4) {
        alert(var1);
        alert(var4);
    });
    // Inject values from all arguments but the last (function)
    ioc.$inject("var2", "var2", function(myvar, myvar2) {
        alert(myvar);
        alert(myvar2);
    });
    // Inject values from firt argument (array)
    ioc.$invoke(["var2", "var4", "var3", "var1"], 
        function(name0, name1, name2, name3) {
            alert(name0);
            alert(name1);
            alert(name2);
            alert(name3);
        });
    ioc.$singleton("timeNow", function() {
        return new Date().getTime();
    });
    setInterval(function() {
        ioc.$invoke(["timeNow"], function(t) {
            console.log(t);
        });
    }, 2500);
} catch(e) {
    console.log(e);
}

TODO

  • $get and $set
  • $call
  • $inject
  • $invoke
  • Argument simple validations
  • Add all
  • $singleton
  • $provider
  • $factory
  • Testing
  • Documentation
  • Case sensitive On/Off (Default: false)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100