From f32e81de6ac0936eadb5e7940cc5e9f07fa6c934 Mon Sep 17 00:00:00 2001 From: Frans Twisk Date: Fri, 19 Apr 2019 14:27:44 +0200 Subject: [PATCH] Add beforeTransition hook --- src/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/index.js b/src/index.js index aed9d42..946ae0f 100644 --- a/src/index.js +++ b/src/index.js @@ -242,6 +242,11 @@ class SmoothElement { debug(`doSmoothReflow triggered by:`, triggeredBy) const afterRect = getBoundingClientRect($smoothEl) + + if (options.beforeTransition) { + this.options.beforeTransition(options, beforeRect, afterRect); + } + if (!this.didValuesChange(beforeRect, afterRect)) { debug(`Property values did not change.`) this.transitionTo(STATES.INACTIVE)