Skip to content

Instantly share code, notes, and snippets.

@dan-gamble
Created January 7, 2019 14:04
Show Gist options
  • Save dan-gamble/83c67656cd07d4bc9f2509c240becd4d to your computer and use it in GitHub Desktop.
Save dan-gamble/83c67656cd07d4bc9f2509c240becd4d to your computer and use it in GitHub Desktop.
import { getElement, getElements } from '../../utils/functional'
export default class Module {
constructor (el) {
this.className = el.dataset.moduleClass
this.context = { context: el }
}
getContextElement (selector) {
return getElement(selector, this.context)
}
getContextElements (selector) {
return getElements(selector, this.context)
}
bindMethods (methods = []) {
methods.forEach(method => (this[method] = this[method].bind(this)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment