Created
January 7, 2019 14:04
-
-
Save dan-gamble/83c67656cd07d4bc9f2509c240becd4d 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 { 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