Forked from AdaRoseCannon/Finished polyfill.js
Last active
August 3, 2020 10:58
Revisions
-
simevidas revised this gist
Aug 22, 2017 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,15 +9,15 @@ if (document.body.animate) { if (Animation.prototype.finished === undefined) { Object.defineProperty(Animation.prototype, 'finished', { get() { if (!this._finished) { this._finished = this.playState === 'finished' ? Promise.resolve() : new Promise((resolve, reject) => { this.addEventListener('finish', resolve, {once: true}); this.addEventListener('cancel', reject, {once: true}); }); } return this._finished; } }); } -
simevidas renamed this gist
Aug 22, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
simevidas renamed this gist
Aug 22, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
simevidas renamed this gist
Aug 22, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
simevidas revised this gist
Aug 22, 2017 . 1 changed file with 23 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,24 @@ // only polyfill .finished in browsers that already support animate() if (document.body.animate) { // Chrome does not seem to expose the Animation constructor globally if (typeof Animation === 'undefined') { window.Animation = document.body.animate({}).constructor; } if (Animation.prototype.finished === undefined) { Object.defineProperty(Animation.prototype, 'finished', { get() { if (!this._finished) { this._finished = this.playState === 'finished' ? Promise.resolve() : new Promise((resolve, reject) => { this.addEventListener('finish', resolve, {once: true}); this.addEventListener('cancel', reject, {once: true}); }); } return this._finished; } }); } } -
Ada Rose Edwards revised this gist
Aug 20, 2017 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ if (document.body.animate && typeof Animation === 'undefined') { window.Animation = document.body.animate({}).constructor; } if (typeof Animation !== 'undefined' && Animation.prototype.finished === undefined) { Object.defineProperty(Animation.prototype, 'finished', {get: function () { if (this.__finishPromise) return this.__finishPromise; -
Ada Rose Edwards revised this gist
Aug 19, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ if (typeof Animation !== 'undefined' && Animation.prototype.finished === undefin this.__finishPromise = Promise.resolve(); } else { this.__finishPromise = new Promise(function (resolve) { this.addEventListener('finish', resolve, {once: true}); }.bind(this)); } return this.__finishPromise; -
Ada Rose Edwards revised this gist
Aug 19, 2017 . 1 changed file with 12 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,13 @@ if (typeof Animation !== 'undefined' && Animation.prototype.finished === undefined) { Object.defineProperty(Animation.prototype, 'finished', {get: function () { if (this.__finishPromise) return this.__finishPromise; if (this.playState === 'finished') { this.__finishPromise = Promise.resolve(); } else { this.__finishPromise = new Promise(function (resolve) { this.addEventListener('finish', resolve); }.bind(this)); } return this.__finishPromise; }}); } -
Ada Rose Edwards revised this gist
Aug 18, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ if (typeof Animation !== 'undefined' && Animation.prototype.finished === undefined) { Object.defineProperty(Animation.prototype, 'finished', {get: function () { return new Promise(function (resolve) { this.addEventListener('finish', resolve); }.bind(this)); }}); } -
Ada Rose Edwards created this gist
Aug 18, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ if (typeof Animation !== 'undefined' && Animation.prototype.finished === undefined) { Object.defineProperty(Animation.prototype, 'finished', {get: function () { return new Promise(function (resolve) { this.addEventListener('finish', resolve); }.bind(this)); }}); }