Guest User

Untitled

a guest
Jun 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class StoreClass {
  2. constructor() {
  3. this._store = {
  4. name:'',
  5. type:''
  6. };
  7. this.rootComponent = {};
  8. }
  9.  
  10. defineRootComponent(component) {
  11. this.rootComponent = component;
  12. }
  13.  
  14. get() {
  15. return this._store;
  16. }
  17.  
  18. setState(newValue) {
  19. this._store = {
  20. ...this._store,
  21. ...newValue
  22. };
  23. this.rootComponent.forceUpdate();
  24. }
  25. }
  26.  
  27. export const Store = new StoreClass();
Add Comment
Please, Sign In to add comment