Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Last active November 2, 2017 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/bcc5009558fe1e8893f53d154032294c to your computer and use it in GitHub Desktop.
Save matthieu-D/bcc5009558fe1e8893f53d154032294c to your computer and use it in GitHub Desktop.
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