Skip to content

Commit

Permalink
feat: add enable & disable methods
Browse files Browse the repository at this point in the history
  • Loading branch information
guidobouman committed May 10, 2018
1 parent 95555e8 commit dcf6db9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/panelSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ export default class PanelSnap {
this.scrollEventContainer.addEventListener('scroll', this.onScroll.bind(this), passiveIsSupported && { passive: true });
}

enable() {
this.isEnabled = true;
}

disable() {
this.isEnabled = false;
}

on(name, handler) {
const currentHandlers = this.events[name] || [];
this.events[name] = [...currentHandlers, handler];
Expand Down Expand Up @@ -139,12 +147,12 @@ export default class PanelSnap {
}

snapToPanel(panel, toBottom = false) {
this.activatePanel(panel);

if (!this.isEnabled) {
return;
}

this.activatePanel(panel);

if (this.animation) {
this.animation.stop();
}
Expand Down

0 comments on commit dcf6db9

Please sign in to comment.