@jam3/gsap-promise
Advanced tools
Comparing version 3.1.1 to 4.0.0
26
base.js
@@ -10,4 +10,4 @@ var TweenMax = require('gsap') | ||
resolve = once(resolve) | ||
wrapCompletion(opts, resolve) | ||
wrapTween(func(element, duration, opts), resolve) | ||
wrapCompletion(opts, resolve, opts) | ||
wrapTween(func(element, duration, opts), resolve, opts) | ||
}) | ||
@@ -26,4 +26,4 @@ } | ||
resolve = once(resolve) | ||
wrapCompletion(opts, resolve) | ||
wrapTween(TweenMax.set(element, opts), resolve) | ||
wrapCompletion(opts, resolve, opts) | ||
wrapTween(TweenMax.set(element, opts), resolve, opts) | ||
}) | ||
@@ -36,4 +36,4 @@ } | ||
resolve = once(resolve) | ||
wrapCompletion(to, resolve) | ||
wrapTween(TweenMax.fromTo(element, duration, from, to), resolve) | ||
wrapCompletion(to, resolve, from) | ||
wrapTween(TweenMax.fromTo(element, duration, from, to), resolve, from) | ||
}) | ||
@@ -47,3 +47,3 @@ } | ||
resolve = once(resolve) | ||
wrapTween(tweenFunc(element, duration, from, stagger, resolve), resolve) | ||
wrapTween(tweenFunc(element, duration, from, stagger, resolve), resolve, from) | ||
}) | ||
@@ -56,3 +56,3 @@ } | ||
resolve = once(resolve) | ||
wrapTween(TweenMax.staggerFromTo(element, duration, from, to, stagger, resolve), resolve) | ||
wrapTween(TweenMax.staggerFromTo(element, duration, from, to, stagger, resolve), resolve, from) | ||
}) | ||
@@ -77,9 +77,13 @@ } | ||
function wrapCompletion (p, done) { | ||
// handle both completion events | ||
function wrapCompletion (p, done, opts = {}) { | ||
p.onComplete = done | ||
if (!opts || !opts.callThenOnKill) return; | ||
delete opts.callThenOnKill | ||
p.onOverwrite = done | ||
} | ||
function wrapTween (tween, resolve) { | ||
function wrapTween (tween, resolve, opts = {}) { | ||
if (!opts || !opts.callThenOnKill) return; | ||
delete opts.callThenOnKill | ||
// GSAP won't call onComplete or onOverwrite with { override: 'all' } | ||
@@ -86,0 +90,0 @@ if (typeof tween._kill === 'function' && !tween._isGSAPPromiseWrapped) { |
{ | ||
"name": "@jam3/gsap-promise", | ||
"version": "3.1.1", | ||
"version": "4.0.0", | ||
"description": "a Promise wrapper around gsap / twenelite", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6491
85