Skip to content

Commit

Permalink
isInitialized → isAlive, and make it a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyunje Jun committed Oct 27, 2017
1 parent a4d5ee9 commit 3bdb13f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,16 @@ export default class PerfectScrollbar {
: null,
};

this.isAlive = true;

this.settings.handlers.forEach(handlerName => handlers[handlerName](this));

this.event.bind(this.element, 'scroll', () => updateGeometry(this));
updateGeometry(this);
}

get isInitialized() {
return this.element.classList.contains(cls.main);
}

update() {
if (!this.isInitialized) {
if (!this.isAlive) {
return;
}

Expand Down Expand Up @@ -193,7 +191,7 @@ export default class PerfectScrollbar {
}

destroy() {
if (!this.isInitialized) {
if (!this.isAlive) {
return;
}

Expand All @@ -210,6 +208,8 @@ export default class PerfectScrollbar {
this.scrollbarY = null;
this.scrollbarXRail = null;
this.scrollbarYRail = null;

this.isAlive = false;
}

removePsClasses() {
Expand Down

0 comments on commit 3bdb13f

Please sign in to comment.