Component initializer middleware for woowahanjs
- woowahanjs v0.3.0 higher
$ npm install --save-dev woowahan-initializer
import Woowahan from 'woowahan';
import Initializer from 'woowahan-initializer';
const app = new Woowahan();
app.set(Initializer);
app.use(Woowahan.Store.create({
config: {
env: 'development',
cache: true
}
}));
import Woowahan from 'woowahan';
export default Woowahan.View.create('myView', {
initConfig: {
initModel: {
loaded: true
},
loadStore: ['config'],
after() {
console.log(this.getModel()); // { config }
}
},
viewDidMount() {
let { config, loaded } = this.getModel();
console.log(config, loaded);
}
});