Last active
February 9, 2017 06:59
-
-
Save vadirn/39db367f77e9c200eac462219b9382ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { injectDeps } from 'components-di'; | |
import RootComponent from '../../ui/views/Example'; | |
class ExampleController { | |
constructor(initialState, context) { | |
// context has store reference and a function to replace controller | |
this._context = context; | |
this._context.store.resetState(initialState); | |
this._view = injectDeps(this.context, this.actions)(RootComponent); | |
} | |
// sometimes we need to clean up after controller, | |
// dispose is called every time when controller is replaced | |
dispose() { } | |
get context() { | |
return this._context; | |
} | |
get actions() { | |
return { }; | |
} | |
get view() { | |
return this._view; | |
} | |
}; | |
export default ExampleController; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment