Last active
November 2, 2017 20:12
-
-
Save matthieu-D/bcc5009558fe1e8893f53d154032294c 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 { Component, State } from '@stencil/core'; | |
@Component({ | |
tag: 'store-manager' | |
}) | |
export class StoreManager { | |
@State() store; | |
constructor() { } | |
create(value){ | |
this.store.dispatch({ type: 'CREATE', payload: {id: Date.now(), value: value}}); | |
} | |
delete(id) { | |
this.store.dispatch({ type: 'DELETE', payload: {id: id}}); | |
} | |
update(id, value) { | |
this.store.dispatch({ type: 'UPDATE', payload: {id: id, value: value}}); | |
} | |
setStore(store) { | |
this.store = store; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment