springbokjs-di
Dependency injection library
How to use
ES5
lib/a.js
a simple singleton
exportsA = { var { }; Asingleton = true; Aprototype { return 'Hello ' + name + '!'; }; return A;};
lib/b.js
b has a dependency with a
exportsB = { var { }; Bsingleton = true; Bdependencies = 'a'; Bprototype { return thisa; }; return B;};
lib/class1.js
An example of non singleton class
exportsClass1 = { var { thisname = name; }; Class1prototype { return 'Hello ' + thisname + '!'; }; return Class1;};
lib/class2.js
For classes, the dependencies are resolved when a class is instancied
exportsClass2 = { var { }; Class2dependencies = 'a'; Class2prototype { thisname = name; }; Class2prototype { return thisa; }; return Class2;};
app.js
var diUtils = ;var Di = diUtilsDi;var di = ;diUtils;
ES6 with es6like-class
lib/a.js
a simple singleton
var A = ;
lib/b.js
b has a dependency with a
var B = ;
lib/class1.js
An example of non singleton class
{ thisname = name; } { return 'Hello ' + thisname + '!'; }
lib/class2.js
For classes, the dependencies are resolved when a class is instancied
var Class2 = ;
app.js
var diUtils = ;var Di = diUtilsDi;var di = ;diUtils;