From ef0933aedf06137b2273e1eca67524a07f057e36 Mon Sep 17 00:00:00 2001 From: Alexander Morse Date: Wed, 25 Sep 2019 14:26:35 -0400 Subject: [PATCH] Set active properties before emitting events --- src/Effect.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Effect.js b/src/Effect.js index 4c7d2547..d48d678a 100644 --- a/src/Effect.js +++ b/src/Effect.js @@ -144,29 +144,30 @@ class Effect extends EventEmitter { if (this.active) { return; } - + this.startedAt = Date.now() - this.elapsed; + this.active = true; + /** * @event Effect#effectActivated */ this.emit('effectActivated'); - this.active = true; } /** - * Set this effect active + * Set this effect inactive * @fires Effect#effectDeactivated */ deactivate() { if (!this.active) { return; } + this.active = false; /** * @event Effect#effectDeactivated */ this.emit('effectDeactivated'); - this.active = false; } /**