radis-react
v0.0.4
Published
A Javascript dependency injection base on Angular.js API for React
Downloads
1
Readme
Quickstart
const { radis } = require('radis');
class Unicorn {
constructor(name) {
this.name = name;
}
poop() {
console.log(`${this.name} poop rainbow`);
}
}
class UnicornProvider {
constructor($injector, name) {
this.name = name;
}
setName(name) {
this.name = name;
}
$get() {
return new Unicorn(this.name);
}
}
radis
.module('app', [])
.provider('alice', UnicornProvider)
.provider('anonymousUnicorn', UnicornProvider)
.config((anonymousUnicornProvider) => anonymousUnicornProvider.setName("paul"))
.run((alice, anonymousUnicorn) => {
alice.poop(); // alice poop rainbow
anonymousUnicorn.poop(); // paul poop rainbow
})
.bootstrap()
;
Requirement
Radis use ES6 syntax internally so it require node >= 6.