Skip to content

Commit

Permalink
#483 changes in index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangarnier committed Jan 17, 2019
1 parent 1df7de0 commit 55b76fc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
12 changes: 7 additions & 5 deletions lib/anime.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,13 +928,14 @@ function anime(params) {
var children, childrenLength = 0;
var resolve = null;

function makePromise() {
return window.Promise && new Promise(function (_resolve) { return resolve = _resolve; });
function makePromise(instance) {
var promise = window.Promise && new Promise(function (_resolve) { return resolve = _resolve; });
instance.finished = promise;
return promise;
}

var promise = makePromise();

var instance = createNewInstance(params);
var promise = makePromise(instance);

function toggleInstanceDirection() {
instance.reversed = !instance.reversed;
Expand Down Expand Up @@ -1084,7 +1085,7 @@ function anime(params) {
setCallback('complete');
if (!instance.passThrough && 'Promise' in window) {
resolve();
promise = makePromise();
promise = makePromise(instance);
}
}
}
Expand Down Expand Up @@ -1136,6 +1137,7 @@ function anime(params) {
instance.play = function() {
if (!instance.paused) { return; }
instance.paused = false;
instance.completed = false;
activeInstances.push(instance);
resetTime();
if (!raf) { engine(); }
Expand Down
12 changes: 7 additions & 5 deletions lib/anime.js
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,14 @@ function anime(params) {
var children, childrenLength = 0;
var resolve = null;

function makePromise() {
return window.Promise && new Promise(function (_resolve) { return resolve = _resolve; });
function makePromise(instance) {
var promise = window.Promise && new Promise(function (_resolve) { return resolve = _resolve; });
instance.finished = promise;
return promise;
}

var promise = makePromise();

var instance = createNewInstance(params);
var promise = makePromise(instance);

function toggleInstanceDirection() {
instance.reversed = !instance.reversed;
Expand Down Expand Up @@ -1086,7 +1087,7 @@ function anime(params) {
setCallback('complete');
if (!instance.passThrough && 'Promise' in window) {
resolve();
promise = makePromise();
promise = makePromise(instance);
}
}
}
Expand Down Expand Up @@ -1138,6 +1139,7 @@ function anime(params) {
instance.play = function() {
if (!instance.paused) { return; }
instance.paused = false;
instance.completed = false;
activeInstances.push(instance);
resetTime();
if (!raf) { engine(); }
Expand Down
2 changes: 1 addition & 1 deletion lib/anime.min.js

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -908,13 +908,14 @@ function anime(params = {}) {
let children, childrenLength = 0;
let resolve = null;

function makePromise() {
return window.Promise && new Promise(_resolve => resolve = _resolve);
function makePromise(instance) {
const promise = window.Promise && new Promise(_resolve => resolve = _resolve);
instance.finished = promise;
return promise;
}

let promise = makePromise();

let instance = createNewInstance(params);
let promise = makePromise(instance);

function toggleInstanceDirection() {
instance.reversed = !instance.reversed;
Expand Down Expand Up @@ -1064,7 +1065,7 @@ function anime(params = {}) {
setCallback('complete');
if (!instance.passThrough && 'Promise' in window) {
resolve();
promise = makePromise();
promise = makePromise(instance);
}
}
}
Expand Down Expand Up @@ -1116,6 +1117,7 @@ function anime(params = {}) {
instance.play = function() {
if (!instance.paused) return;
instance.paused = false;
instance.completed = false;
activeInstances.push(instance);
resetTime();
if (!raf) engine();
Expand Down

0 comments on commit 55b76fc

Please sign in to comment.