New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tina

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tina - npm Package Compare versions

Comparing version 0.2.9 to 0.2.10

src/SortedList.js

10

build/tina.min.js

@@ -14,3 +14,3 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

},{"./BoundedPlayable":2}],5:[function(require,module,exports){
function ListNode(t,e,o,i){this.object=t,this.prev=e,this.next=o,this.container=i}function DoublyList(){this.first=null,this.last=null,this.length=0}module.exports=DoublyList,DoublyList.prototype.addFront=function(t){var e=new ListNode(t,null,this.first,this);return null===this.first?(this.first=e,this.last=e):(this.first.prev=e,this.first=e),this.length+=1,e},DoublyList.prototype.add=DoublyList.prototype.addFront,DoublyList.prototype.addBack=function(t){var e=new ListNode(t,this.last,null,this);return null===this.first?(this.first=e,this.last=e):(this.last.next=e,this.last=e),this.length+=1,e},DoublyList.prototype.popFront=function(t){var e=this.first.object;return this.removeByReference(this.first),e},DoublyList.prototype.pop=DoublyList.prototype.popFront,DoublyList.prototype.popBack=function(t){var e=this.last.object;return this.removeByReference(this.last),e},DoublyList.prototype.removeByReference=function(t){return t.container!==this?(console.warn("[DoublyList.removeByReference] Trying to remove a node that does not belong to the list"),t):(null===t.next?this.last=t.prev:t.next.prev=t.prev,null===t.prev?this.first=t.next:t.prev.next=t.next,t.container=null,this.length-=1,null)},DoublyList.prototype.remove=function(t){for(var e=this.first;null!==e;e=e.next)if(e.object===t)return this.removeByReference(e),!0;return!1},DoublyList.prototype.clear=function(){for(var t=this.first;null!==t;t=t.next)t.container=null;this.first=null,this.last=null,this.length=0},DoublyList.prototype.forEach=function(t,e){for(var o=this.first;o;o=o.next)t(o.object,e)},DoublyList.prototype.toArray=function(){for(var t=[],e=this.first;null!==e;e=e.next)t.push(e.object);return t};
function ListNode(t,e,o,i){this.object=t,this.prev=e,this.next=o,this.container=i}function DoublyList(){this.first=null,this.last=null,this.length=0}module.exports=DoublyList,DoublyList.prototype.addFront=function(t){var e=new ListNode(t,null,this.first,this);return null===this.first?(this.first=e,this.last=e):(this.first.prev=e,this.first=e),this.length+=1,e},DoublyList.prototype.add=DoublyList.prototype.addFront,DoublyList.prototype.addBack=function(t){var e=new ListNode(t,this.last,null,this);return null===this.first?(this.first=e,this.last=e):(this.last.next=e,this.last=e),this.length+=1,e},DoublyList.prototype.popFront=function(t){var e=this.first.object;return this.removeByReference(this.first),e},DoublyList.prototype.pop=DoublyList.prototype.popFront,DoublyList.prototype.popBack=function(t){var e=this.last.object;return this.removeByReference(this.last),e},DoublyList.prototype.removeByReference=function(t){return t.container!==this?(console.warn("[DoublyList.removeByReference] Trying to remove a node that does not belong to the list"),t):(null===t.next?this.last=t.prev:t.next.prev=t.prev,null===t.prev?this.first=t.next:t.prev.next=t.next,t.next=null,t.prev=null,t.container=null,this.length-=1,null)},DoublyList.prototype.remove=function(t){for(var e=this.first;null!==e;e=e.next)if(e.object===t)return this.removeByReference(e),!0;return!1},DoublyList.prototype.clear=function(){for(var t=this.first;null!==t;t=t.next)t.container=null;this.first=null,this.last=null,this.length=0},DoublyList.prototype.forEach=function(t,e){for(var o=this.first;o;o=o.next)t(o.object,e)},DoublyList.prototype.toArray=function(){for(var t=[],e=this.first;null!==e;e=e.next)t.push(e.object);return t};

@@ -33,4 +33,6 @@ },{}],6:[function(require,module,exports){

},{"./Timeline":13}],11:[function(require,module,exports){
var requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(n){window.setTimeout(n,1e3/60)}}(),clock=window.performance||Date,TINA={_tweeners:[],_defaultTweener:null,_running:!1,_startTime:0,_time:0,_onStart:null,_onPause:null,_onResume:null,_onUpdate:null,_onStop:null,_pauseOnLostFocus:!1,onStart:function(n){return this._onStart=n,this},onUpdate:function(n){return this._onUpdate=n,this},onStop:function(n){return this._onStop=n,this},onPause:function(n){return this._onPause=n,this},isRunning:function(){return this._running},update:function(){var n=clock.now()-this._startTime,e=n-this._time;if(!(0>e)){this._time=n;for(var t=this._tweeners.slice(0),i=0;i<t.length;i+=1)t[i]._moveTo(this._time,e);null!==this._onUpdate&&this._onUpdate(this._time,e)}},reset:function(){this._startTime=clock.now(),this._time=0},start:function(){function n(){TINA._running===!0&&(TINA.update(),requestAnimFrame(n))}if(this._running===!0)return console.warn("[TINA.start] TINA is already running"),this;null!==this._onStart&&this._onStart(),this._startTime=clock.now(),this._time=0;for(var e=0;e<this._tweeners.length;e+=1)this._tweeners[e]._start();return this._running=!0,requestAnimFrame(n),this},pause:function(){if(this._running===!1)return console.warn("[TINA.pause] TINA is not running"),this;this._running=!1;for(var n=0;n<this._tweeners.length;n+=1)this._tweeners[n]._pause();return null!==this._onPause&&this._onPause(),this},resume:function(){if(this._running===!0)return console.warn("[TINA.resume] TINA is already running"),this;this._running=!0,null!==this._onResume&&this._onResume();for(var n=0;n<this._tweeners.length;n+=1)this._tweeners[n]._resume();var e=clock.now(),t=e-this._time;return this._startTime+=t,this},stop:function(){this._running=!1;for(var n=this._tweeners.slice(0),e=0;e<n.length;e+=1)n[e]._stop();return this._tweeners=n,null!==this._onStop&&this._onStop(),this},pauseOnLostFocus:function(n){return this._pauseOnLostFocus=n,this},setDefaultTweener:function(n){this._defaultTweener=n,this._tweeners.push(this._defaultTweener)},getDefaultTweener:function(){return this._defaultTweener},_add:function(n){this._running===!1&&this.start(),this._tweeners.push(n)},add:function(n){return this._tweeners.push(n),this},_inactivate:function(n){var e=this._tweeners.indexOf(n);-1!==e&&this._tweeners.splice(e,1)},remove:function(n){return this._inactivate(n),this},_getDefaultTweener:function(){if(null===this._defaultTweener){var n=this.Timer;this._defaultTweener=(new n).start()}return this._defaultTweener}},hidden,visbilityChange;if("undefined"!=typeof document.hidden?(hidden="hidden",visbilityChange="visibilitychange"):"undefined"!=typeof document.mozHidden?(hidden="mozHidden",visbilityChange="mozvisibilitychange"):"undefined"!=typeof document.msHidden?(hidden="msHidden",visbilityChange="msvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(hidden="webkitHidden",visbilityChange="webkitvisibilitychange"),"undefined"==typeof document[hidden])this._warn("[Tweener] Cannot pause on lost focus because the browser does not support the Page Visibility API");else{var wasRunning=!1;document.addEventListener(visbilityChange,function(){document[hidden]&&(wasRunning=TINA.isRunning(),wasRunning&&TINA._pauseOnLostFocus&&TINA.pause()),document[hidden]||wasRunning&&TINA._pauseOnLostFocus&&TINA.resume()},!1)}!function(n){n.TINA=TINA,n!==window&&window&&(window.TINA=TINA)}(this),module.exports=TINA;
(function (global){
var root;"undefined"!=typeof window?root=window:"undefined"!=typeof global?root=global:(console.warn("[TINA] Your environment might not support TINA."),root=this);var requestAnimFrame=function(){return root.requestAnimationFrame||root.webkitRequestAnimationFrame||root.mozRequestAnimationFrame||root.oRequestAnimationFrame||root.msRequestAnimationFrame||function(t){root.setTimeout(t,1e3/60)}}(),clock=root.performance||Date,TINA={_tweeners:[],_defaultTweener:null,_startTime:0,_time:0,_running:!1,_onStart:null,_onPause:null,_onResume:null,_onUpdate:null,_onStop:null,_pauseOnLostFocus:!1,_pauseOnLostFocusInitialised:!1,onStart:function(t){return this._onStart=t,this},onUpdate:function(t){return this._onUpdate=t,this},onStop:function(t){return this._onStop=t,this},onPause:function(t){return this._onPause=t,this},isRunning:function(){return this._running===!0},update:function(){var t=clock.now()-this._startTime,e=t-this._time;if(!(0>e)){this._time=t;for(var n=this._tweeners.slice(0),i=0;i<n.length;i+=1)n[i]._moveTo(this._time,e);null!==this._onUpdate&&this._onUpdate(this._time,e)}},reset:function(){this._startTime=clock.now(),this._time=0},start:function(){if(this._startAutomaticUpdate()!==!1){null!==this._onStart&&this._onStart(),this._startTime=clock.now(),this._time=0;for(var t=0;t<this._tweeners.length;t+=1)this._tweeners[t]._start();return this}},stop:function(){if(this._stopAutomaticUpdate()!==!1){for(var t=this._tweeners.slice(0),e=0;e<t.length;e+=1)t[e]._stop();return this._tweeners=t,null!==this._onStop&&this._onStop(),this}},_startAutomaticUpdate:function(){function t(){TINA._running===!0&&(TINA.update(),requestAnimFrame(t))}return this._running===!0?(console.warn("[TINA.start] TINA is already running"),!1):(this._running=!0,requestAnimFrame(t),!0)},_stopAutomaticUpdate:function(){return this._running===!1?(console.warn("[TINA.pause] TINA is not running"),!1):(this._running=!1,!0)},pause:function(){if(this._stopAutomaticUpdate()!==!1){for(var t=0;t<this._tweeners.length;t+=1)this._tweeners[t]._pause();return null!==this._onPause&&this._onPause(),this}},resume:function(){if(this._startAutomaticUpdate()!==!1){null!==this._onResume&&this._onResume();var t=clock.now(),e=t-this._time;this._startTime+=e;for(var n=0;n<this._tweeners.length;n+=1)this._tweeners[n]._resume();return this}},_initialisePauseOnLostFocus:function(){if(this._pauseOnLostFocusInitialised!==!0){if(void 0===document)return void console.warn("[TINA.pauseOnLostFocus] Cannot pause on lost focus because TINA is not running in a webpage (node.js does not allow this functionality)");var t,e;if("undefined"!=typeof document.hidden?(t="hidden",e="visibilitychange"):"undefined"!=typeof document.mozHidden?(t="mozHidden",e="mozvisibilitychange"):"undefined"!=typeof document.msHidden?(t="msHidden",e="msvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(t="webkitHidden",e="webkitvisibilitychange"),"undefined"==typeof document[t])return void console.warn("[Tweener] Cannot pause on lost focus because the browser does not support the Page Visibility API");this._pauseOnLostFocusInitialised=!0;var n=!1;document.addEventListener(e,function(){document[t]&&(n=TINA.isRunning(),n&&TINA._pauseOnLostFocus&&TINA.pause()),document[t]||n&&TINA._pauseOnLostFocus&&TINA.resume()},!1)}},pauseOnLostFocus:function(t){return t===!0&&this._pauseOnLostFocusInitialised===!1&&this._initialisePauseOnLostFocus(),this._pauseOnLostFocus=t,this},setDefaultTweener:function(t){this._defaultTweener=t,this._tweeners.push(this._defaultTweener)},getDefaultTweener:function(){return this._defaultTweener},_add:function(t){this._running===!1&&this.start(),this._tweeners.push(t)},add:function(t){return this._tweeners.push(t),this},_inactivate:function(t){var e=this._tweeners.indexOf(t);-1!==e&&this._tweeners.splice(e,1)},remove:function(t){return this._inactivate(t),this},_getDefaultTweener:function(){if(null===this._defaultTweener){var t=this.Timer;this._defaultTweener=(new t).start()}return this._defaultTweener}};module.exports=global.TINA=TINA;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],12:[function(require,module,exports){

@@ -43,3 +45,3 @@ function Ticker(t){return this instanceof Ticker==!1?new Ticker(t):(Tweener.call(this),this._tupt=t||1,void(this._nbTicks=0))}var Tweener=require("./Tweener");Ticker.prototype=Object.create(Tweener.prototype),Ticker.prototype.constructor=Ticker,module.exports=Ticker,Object.defineProperty(Ticker.prototype,"tupt",{get:function(){return this._tupt},set:function(t){0>t&&(this._warn("[Timer.tupt] tupt cannot be negative, stop messing with time."),t=0),this._tupt=t}}),Ticker.prototype._getElapsedTime=function(){return this._tupt*this._nbTicks++},Ticker.prototype._getSingleStepDuration=function(){return this._tupt},Ticker.prototype.convertToTicks=function(t){return t/this._tupt},Ticker.prototype.convertToTimeUnits=function(t){return t*this._tupt};

},{"./BoundedPlayer":3}],14:[function(require,module,exports){
function Timer(t){return this instanceof Timer==!1?new Timer(t):(Tweener.call(this),void(this._tups=t||1e3))}var Tweener=require("./Tweener"),clock=window.performance||Date;Timer.prototype=Object.create(Tweener.prototype),Timer.prototype.constructor=Timer,module.exports=Timer,Object.defineProperty(Timer.prototype,"tups",{get:function(){return this._tups},set:function(t){0>t&&(this._warn("[Timer.tups] tups cannot be negative, stop messing with time."),t=0);this._time-this._startTime;0===t?this._startTime+=this._time/this._tups-this._time:0===this._tups?this._startTime=this._time-this._time/t:this._startTime=this._time/this._tups-this._time/t,this._tups=t}}),Timer.prototype._getElapsedTime=function(t){return this._tups*(t-this._startTime)/1e3},Timer.prototype._getSingleStepDuration=function(t){return this._tups*t/1e3},Timer.prototype.convertToSeconds=function(t){return t/this._tups},Timer.prototype.convertToTimeUnits=function(t){return t*this._tups};
function Timer(t){return this instanceof Timer==!1?new Timer(t):(Tweener.call(this),void(this._tups=t||1e3))}var Tweener=require("./Tweener");Timer.prototype=Object.create(Tweener.prototype),Timer.prototype.constructor=Timer,module.exports=Timer,Object.defineProperty(Timer.prototype,"tups",{get:function(){return this._tups},set:function(t){0>t&&(this._warn("[Timer.tups] tups cannot be negative, stop messing with time."),t=0);this._time-this._startTime;0===t?this._startTime+=this._time/this._tups-this._time:0===this._tups?this._startTime=this._time-this._time/t:this._startTime=this._time/this._tups-this._time/t,this._tups=t}}),Timer.prototype._getElapsedTime=function(t){return this._tups*(t-this._startTime)/1e3},Timer.prototype._getSingleStepDuration=function(t){return this._tups*t/1e3},Timer.prototype.convertToSeconds=function(t){return t/this._tups},Timer.prototype.convertToTimeUnits=function(t){return t*this._tups};

@@ -62,3 +64,3 @@ },{"./Tweener":18}],15:[function(require,module,exports){

},{}],20:[function(require,module,exports){
var TINA=require("./TINA.js");TINA.Tweener=require("./Tweener"),TINA.Timer=require("./Timer"),TINA.Ticker=require("./Ticker"),TINA.Playable=require("./Playable"),TINA.BoundedPlayable=require("./BoundedPlayable"),TINA.PlayableHandler=require("./PlayableHandler"),TINA.BoundedPlayer=require("./BoundedPlayer"),TINA.Player=require("./Player"),TINA.Tween=require("./Tween"),TINA.NestedTween=require("./NestedTween"),TINA.PixiTween=require("./NestedTween"),TINA.Timeline=require("./Timeline"),TINA.Sequence=require("./Sequence"),TINA.Delay=require("./Delay"),TINA.easing=require("./easing"),TINA.interpolation=require("./interpolation"),module.exports=TINA;
var TINA=require("./TINA.js");TINA.Delay=require("./Delay"),TINA.BoundedPlayable=require("./BoundedPlayable"),TINA.BoundedPlayer=require("./BoundedPlayer"),TINA.easing=require("./easing"),TINA.interpolation=require("./interpolation"),TINA.NestedTween=require("./NestedTween"),TINA.PixiTween=require("./NestedTween"),TINA.Playable=require("./Playable"),TINA.PlayableHandler=require("./PlayableHandler"),TINA.Player=require("./Player"),TINA.Sequence=require("./Sequence"),TINA.Ticker=require("./Ticker"),TINA.Timeline=require("./Timeline"),TINA.Timer=require("./Timer"),TINA.Tween=require("./Tween"),TINA.Tweener=require("./Tweener"),module.exports=TINA;
},{"./BoundedPlayable":2,"./BoundedPlayer":3,"./Delay":4,"./NestedTween":6,"./Playable":7,"./PlayableHandler":8,"./Player":9,"./Sequence":10,"./TINA.js":11,"./Ticker":12,"./Timeline":13,"./Timer":14,"./Tween":17,"./Tweener":18,"./easing":19,"./interpolation":22}],21:[function(require,module,exports){

@@ -65,0 +67,0 @@ module.exports=function(o,t){for(var e=Object.keys(t.prototype),p=0;p<e.length;p+=1){var r=e[p];o.prototype[r]=t.prototype[r]}};

2

package.json
{
"name": "tina",
"version": "0.2.9",
"version": "0.2.10",
"description": "Tweening and INterpolations for Animation",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -80,2 +80,3 @@ /**

// Removing any existing reference to the node
if (node.next === null) {

@@ -85,3 +86,2 @@ this.last = node.prev;

node.next.prev = node.prev;
// node.next = null;
}

@@ -93,6 +93,10 @@

node.prev.next = node.next;
// node.prev = null;
}
// Removing any existing reference from the node
node.next = null;
node.prev = null;
node.container = null;
// One less node in the list
this.length -= 1;

@@ -99,0 +103,0 @@

var TINA = require('./TINA.js');
TINA.Tweener = require('./Tweener');
TINA.Timer = require('./Timer');
TINA.Ticker = require('./Ticker');
TINA.Playable = require('./Playable');
// TINA.CSSTween = require('./CSSTween');
TINA.Delay = require('./Delay');
TINA.BoundedPlayable = require('./BoundedPlayable');
TINA.PlayableHandler = require('./PlayableHandler');
TINA.BoundedPlayer = require('./BoundedPlayer');
TINA.Player = require('./Player');
TINA.Tween = require('./Tween');
TINA.easing = require('./easing');
TINA.interpolation = require('./interpolation');
TINA.NestedTween = require('./NestedTween');
// TINA.CSSTween = require('./CSSTween');
TINA.PixiTween = require('./NestedTween');
TINA.Playable = require('./Playable');
TINA.PlayableHandler = require('./PlayableHandler');
TINA.Player = require('./Player');
// TINA.Recorder = require('./Recorder');
TINA.Sequence = require('./Sequence');
TINA.Ticker = require('./Ticker');
TINA.Timeline = require('./Timeline');
TINA.Sequence = require('./Sequence');
// TINA.Recorder = require('./Recorder');
TINA.Delay = require('./Delay');
TINA.easing = require('./easing');
TINA.interpolation = require('./interpolation');
TINA.Timer = require('./Timer');
TINA.Tween = require('./Tween');
TINA.Tweener = require('./Tweener');
module.exports = TINA;
var Tweener = require('./Tweener');
// Performance.now gives better precision than Date.now
var clock = window.performance || Date;
/**

@@ -7,0 +4,0 @@ *

@@ -11,5 +11,2 @@

* Tweening and INterpolations for Animation
*
* Animation library to easily create and customisable tweens,
* timelines, sequences and other playable components.
*

@@ -20,30 +17,38 @@ * Note: if you want a particular component to be added

// window within a browser, global within node
var root;
if (typeof(window) !== 'undefined') {
root = window;
} else if (typeof(global) !== 'undefined') {
root = global;
} else {
console.warn('[TINA] Your environment might not support TINA.');
root = this;
}
// Method to trigger automatic update of TINA
var requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame
return root.requestAnimationFrame ||
root.webkitRequestAnimationFrame ||
root.mozRequestAnimationFrame ||
root.oRequestAnimationFrame ||
root.msRequestAnimationFrame ||
function(callback){
root.setTimeout(callback, 1000 / 60);
};
})();
var cancelAnimFrame = (function(){
return window.cancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.mozCancelAnimationFrame ||
window.oCancelAnimationFrame ||
window.msCancelAnimationFrame
})();
// Performance.now gives better precision than Date.now
var clock = window.performance || Date;
var clock = root.performance || Date;
var TINA = {
_tweeners: [],
_defaultTweener: null,
_requestAnimFrameId: null,
_startTime: 0,
_time: 0,
_time: 0,
_running: false,
// callbacks

@@ -56,3 +61,4 @@ _onStart: null,

_pauseOnLostFocus: false,
_pauseOnLostFocus: false,
_pauseOnLostFocusInitialised: false,

@@ -80,3 +86,3 @@ onStart: function (onStart) {

isRunning: function () {
return (this._requestAnimFrameId !== null);
return (this._running === true);
},

@@ -119,5 +125,4 @@

start: function () {
if (this._requestAnimFrameId !== null) {
console.warn('[TINA.start] TINA is already running');
return this;
if (this._startAutomaticUpdate() === false) {
return;
}

@@ -137,21 +142,10 @@

this._startAutomaticUpdate();
return this;
},
// internal start method, called by start and resume
_startAutomaticUpdate: function () {
function updateTINA() {
if (TINA._requestAnimFrameId !== null) {
TINA.update();
requestAnimFrame(updateTINA);
}
stop: function () {
if (this._stopAutomaticUpdate() === false) {
return;
}
// Starting the animation loop
this._requestAnimFrameId = requestAnimFrame(updateTINA);
},
stop: function () {
this._running = false;
var runningTweeners = this._tweeners.slice(0);

@@ -170,20 +164,42 @@ for (var t = 0; t < runningTweeners.length; t += 1) {

this._stopAutomaticUpdate();
return this;
},
// internal start method, called by start and resume
_startAutomaticUpdate: function () {
if (this._running === true) {
console.warn('[TINA.start] TINA is already running');
return false;
}
function updateTINA() {
if (TINA._running === true) {
TINA.update();
requestAnimFrame(updateTINA);
}
}
// Starting the animation loop
this._running = true;
requestAnimFrame(updateTINA);
return true;
},
// Internal stop method, called by stop and pause
_stopAutomaticUpdate: function () {
// Starting the animation loop
cancelAnimFrame(this._requestAnimFrameId);
this._requestAnimFrameId = null;
if (this._running === false) {
console.warn('[TINA.pause] TINA is not running');
return false;
}
// Stopping the animation loop
this._running = false;
return true;
},
pause: function () {
if (this._requestAnimFrameId === null) {
console.warn('[TINA.pause] TINA is not running');
return this;
if (this._stopAutomaticUpdate() === false) {
return;
}
this._running = false;
for (var t = 0; t < this._tweeners.length; t += 1) {

@@ -196,4 +212,2 @@ this._tweeners[t]._pause();

}
this._stopAutomaticUpdate();
return this;

@@ -203,8 +217,6 @@ },

resume: function () {
if (this._running === true) {
console.warn('[TINA.resume] TINA is already running');
return this;
if (this._startAutomaticUpdate() === false) {
return;
}
this._running = true;
if (this._onResume !== null) {

@@ -227,7 +239,66 @@ this._onResume();

this._startAutomaticUpdate();
return this;
},
_initialisePauseOnLostFocus: function () {
if (this._pauseOnLostFocusInitialised === true) {
return;
}
if (document === undefined) {
// Document is not defined (TINA might be running on node.js)
console.warn('[TINA.pauseOnLostFocus] Cannot pause on lost focus because TINA is not running in a webpage (node.js does not allow this functionality)');
return;
}
// To handle lost of focus of the page
var hidden, visbilityChange;
if (typeof document.hidden !== 'undefined') {
// Recent browser support
hidden = 'hidden';
visbilityChange = 'visibilitychange';
} else if (typeof document.mozHidden !== 'undefined') {
hidden = 'mozHidden';
visbilityChange = 'mozvisibilitychange';
} else if (typeof document.msHidden !== 'undefined') {
hidden = 'msHidden';
visbilityChange = 'msvisibilitychange';
} else if (typeof document.webkitHidden !== 'undefined') {
hidden = 'webkitHidden';
visbilityChange = 'webkitvisibilitychange';
}
if (typeof document[hidden] === 'undefined') {
console.warn('[Tweener] Cannot pause on lost focus because the browser does not support the Page Visibility API');
return;
}
this._pauseOnLostFocusInitialised = true;
// Handle page visibility change
var wasRunning = false;
document.addEventListener(visbilityChange, function () {
if (document[hidden]) {
// document is hiding
wasRunning = TINA.isRunning();
if (wasRunning && TINA._pauseOnLostFocus) {
TINA.pause();
}
}
if (!document[hidden]) {
// document is back (we missed you buddy)
if (wasRunning && TINA._pauseOnLostFocus) {
// Running TINA only if it was running when the document focus was lost
TINA.resume();
}
}
}, false);
},
pauseOnLostFocus: function (pauseOnLostFocus) {
if (pauseOnLostFocus === true && this._pauseOnLostFocusInitialised === false) {
this._initialisePauseOnLostFocus();
}
this._pauseOnLostFocus = pauseOnLostFocus;

@@ -285,52 +356,2 @@ return this;

// To handle lost of focus of the page
// Constants to manage lost of focus of the page
var hidden, visbilityChange;
if (typeof document.hidden !== 'undefined') {
// Recent browser support
hidden = 'hidden';
visbilityChange = 'visibilitychange';
} else if (typeof document.mozHidden !== 'undefined') {
hidden = 'mozHidden';
visbilityChange = 'mozvisibilitychange';
} else if (typeof document.msHidden !== 'undefined') {
hidden = 'msHidden';
visbilityChange = 'msvisibilitychange';
} else if (typeof document.webkitHidden !== 'undefined') {
hidden = 'webkitHidden';
visbilityChange = 'webkitvisibilitychange';
}
if (typeof document[hidden] === 'undefined') {
this._warn('[Tweener] Cannot pause on lost focus because the browser does not support the Page Visibility API');
} else {
// Handle page visibility change
var wasRunning = false;
document.addEventListener(visbilityChange, function () {
if (document[hidden]) {
// document is hiding
wasRunning = TINA.isRunning();
if (wasRunning && TINA._pauseOnLostFocus) {
TINA.pause();
}
}
if (!document[hidden]) {
// document is back (we missed you buddy)
if (wasRunning && TINA._pauseOnLostFocus) {
// Running TINA only if it was running when the document focus was lost
TINA.resume();
}
}
}, false);
}
(function (root) {
// Global variable
root.TINA = TINA;
if (root !== window && window) {
window.TINA = TINA;
}
})(this);
module.exports = TINA;
module.exports = global.TINA = TINA;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc