Skip to content

Instantly share code, notes, and snippets.

@alizhdanov
Created October 19, 2017 16:00
Show Gist options
  • Save alizhdanov/03507219d7fcb824386cc4e6d46eabe3 to your computer and use it in GitHub Desktop.
Save alizhdanov/03507219d7fcb824386cc4e6d46eabe3 to your computer and use it in GitHub Desktop.
import Util from './src/util'
const Default = {
toggle : true,
parent : ''
}
class Collapse {
constructor(element, config) {
this._isTransitioning = false
this._element = element
this._config = this._getConfig(config)
this._triggerArray = Array.from(document.querySelectorAll(`[data-toggle="collapse"][href="#${element.id}"], [data-toggle="collapse"][data-target="#${element.id}`))
}
_getConfig(config) {
config = Object.assign({}, Default, config)
config.toggle = Boolean(config.toggle) // coerce string values
Util.typeCheckConfig(NAME, config, DefaultType)
return config
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment