Skip to content

Instantly share code, notes, and snippets.

@peterbsmyth
Created August 2, 2018 13:31
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 peterbsmyth/b93ecb5bdb96fdcf432ac8731dde8f45 to your computer and use it in GitHub Desktop.
Save peterbsmyth/b93ecb5bdb96fdcf432ac8731dde8f45 to your computer and use it in GitHub Desktop.
const { $ } = require('../../helpers/query')
module.exports = class SaveButton {
constructor (store) {
this.$input = $('#btn')
this.store = store
this.actions = {}
this.actionTypes = {}
}
// Event Handlers
onClick (e) {
e.preventDefault()
this.store.dispatch(this.actions.save())
}
addEvents () {
this.$input.addEventListener('click', this.onClick.bind(this))
}
// Rquired Methods
init ({ actionTypes, actions }) {
this.actions = actions
this.actionTypes = actionTypes
this.addEvents()
}
refresh ({ actionTypes, actions }) {
this.actions = actions
this.actionTypes = actionTypes
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment