Socket
Socket
Sign inDemoInstall

@pixi/ticker

Package Overview
Dependencies
Maintainers
3
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/ticker - npm Package Compare versions

Comparing version 5.0.0-alpha.3 to 5.0.0-rc

167

lib/ticker.es.js
/*!
* @pixi/ticker - v5.0.0-alpha.3
* Compiled Tue, 03 Jul 2018 04:08:21 UTC
* @pixi/ticker - v5.0.0-rc
* Compiled Fri, 01 Feb 2019 04:50:10 UTC
*

@@ -8,3 +8,3 @@ * @pixi/ticker is licensed under the MIT License.

*/
import { settings as settings$1 } from '@pixi/settings';
import { settings } from '@pixi/settings';

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

* @static
* @name TARGET_FPMS
* @memberof PIXI.settings

@@ -20,3 +21,3 @@ * @type {number}

*/
settings$1.TARGET_FPMS = 0.06;
settings.TARGET_FPMS = 0.06;

@@ -62,2 +63,3 @@ /**

* The handler function to execute.
* @private
* @member {Function}

@@ -69,2 +71,3 @@ */

* The calling to execute.
* @private
* @member {Function}

@@ -76,2 +79,3 @@ */

* The current priority.
* @private
* @member {number}

@@ -83,2 +87,3 @@ */

* If this should only execute once.
* @private
* @member {boolean}

@@ -90,2 +95,3 @@ */

* The next item in chain.
* @private
* @member {TickerListener}

@@ -97,2 +103,3 @@ */

* The previous item in chain.
* @private
* @member {TickerListener}

@@ -112,3 +119,3 @@ */

* Simple compare function to figure out if a function and context match.
*
* @private
* @param {Function} fn - The listener function to be added for one update

@@ -127,2 +134,3 @@ * @param {Function} context - The listener context

* Emit by calling the current function.
* @private
* @param {number} deltaTime - time since the last emit.

@@ -164,2 +172,3 @@ * @return {TickerListener} Next ticker

* Connect to the list.
* @private
* @param {TickerListener} previous - Input node, previous listener

@@ -180,2 +189,3 @@ */

* Destroy and don't use after this.
* @private
* @param {boolean} [hard = false] `true` to remove the `next` reference, this

@@ -216,7 +226,6 @@ * is considered a hard destroy. Soft destroy maintains the next reference.

* A Ticker class that runs an update loop that other objects listen to.
* This class is composed around listeners
* meant for execution on the next requested animation frame.
* Animation frames are requested only when necessary,
* e.g. When the ticker is started and the emitter has listeners.
*
* This class is composed around listeners meant for execution on the next requested animation frame.
* Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.
*
* @class

@@ -238,2 +247,3 @@ * @memberof PIXI

* Internal current frame request ID
* @type {?number}
* @private

@@ -246,2 +256,3 @@ */

* This is the maximum allowed milliseconds between updates.
* @type {number}
* @private

@@ -252,2 +263,9 @@ */

/**
* Internal value managed by maxFPS property setter and getter.
* This is the minimum allowed milliseconds between updates.
* @private
*/
this._minElapsedMS = 0;
/**
* Whether or not this ticker should invoke the method

@@ -274,2 +292,16 @@ * {@link PIXI.Ticker#start} automatically

/**
* Scaler time elapsed in milliseconds from last frame to this frame.
* This value is capped by setting {@link PIXI.Ticker#minFPS}
* and is scaled with {@link PIXI.Ticker#speed}.
* **Note:** The cap may be exceeded by scaling.
* If the platform supports DOMHighResTimeStamp,
* this value will have a precision of 1 µs.
* Defaults to target frame time
*
* @member {number}
* @default 16.66
*/
this.deltaMS = 1 / settings.TARGET_FPMS;
/**
* Time elapsed in milliseconds from last frame to this frame.

@@ -285,3 +317,3 @@ * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}

*/
this.elapsedMS = 1 / settings$1.TARGET_FPMS;
this.elapsedMS = 1 / settings.TARGET_FPMS;

@@ -360,4 +392,4 @@ /**

var prototypeAccessors = { FPS: { configurable: true },minFPS: { configurable: true } };
var staticAccessors = { shared: { configurable: true } };
var prototypeAccessors = { FPS: { configurable: true },minFPS: { configurable: true },maxFPS: { configurable: true } };
var staticAccessors = { shared: { configurable: true },system: { configurable: true } };

@@ -592,3 +624,2 @@ /**

{
var this$1 = this;
if ( currentTime === void 0 ) currentTime = performance.now();

@@ -624,4 +655,16 @@

this.deltaTime = elapsedMS * settings$1.TARGET_FPMS * this.speed;
elapsedMS *= this.speed;
// if not enough time has passed, exit the function.
// We give an extra ms to elapsedMS for this check, because the nature of
// request animation frame means that not all browsers will return precise values.
// However, because rAF works based on v-sync, it's won't change the effective FPS.
if (this._minElapsedMS && elapsedMS + 1 < this._minElapsedMS)
{
return;
}
this.deltaMS = elapsedMS;
this.deltaTime = this.deltaMS * settings.TARGET_FPMS;
// Cache a local reference, in-case ticker is destroyed

@@ -636,3 +679,3 @@ // during the emit, we can still check for head.next

{
listener = listener.emit(this$1.deltaTime);
listener = listener.emit(this.deltaTime);
}

@@ -647,3 +690,3 @@

{
this.deltaTime = this.elapsedMS = 0;
this.deltaTime = this.deltaMS = this.elapsedMS = 0;
}

@@ -687,5 +730,8 @@

{
// Clamp: 0 to TARGET_FPMS
var minFPMS = Math.min(Math.max(0, fps) / 1000, settings$1.TARGET_FPMS);
// Minimum must be below the maxFPS
var minFPS = Math.min(this.maxFPS, fps);
// Must be at least 0, but below 1 / settings.TARGET_FPMS
var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);
this._maxElapsedMS = 1 / minFPMS;

@@ -695,8 +741,48 @@ };

/**
* The shared ticker instance used by {@link PIXI.AnimatedSprite}.
* and by {@link PIXI.interaction.InteractionManager}.
* The property {@link PIXI.Ticker#autoStart} is set to `true`
* for this instance. Please follow the examples for usage, including
* how to opt-out of auto-starting the shared ticker.
* Manages the minimum amount of milliseconds allowed to
* elapse between invoking {@link PIXI.Ticker#update}.
* This will effect the measured value of {@link PIXI.ticker.Ticker#FPS}.
* When setting this property it is clamped to a value between
* `1` and `TARGET_FPMS * 1000`.
*
* @member {number}
* @default 60
*/
prototypeAccessors.maxFPS.get = function ()
{
if (this._minElapsedMS)
{
return 1000 / this._minElapsedMS;
}
return settings.TARGET_FPMS * 1000;
};
prototypeAccessors.maxFPS.set = function (fps)
{
if (fps / 1000 >= settings.TARGET_FPMS)
{
this._minElapsedMS = 0;
}
else
{
// Max must be at least the minFPS
var maxFPS = Math.max(this.minFPS, fps);
// Must be at least 1, but below 1 / settings.TARGET_FPMS
var maxFPMS = Math.min(Math.max(1, maxFPS) / 1000, settings.TARGET_FPMS);
this._minElapsedMS = 1 / maxFPMS;
}
};
/**
* The shared ticker instance used by {@link PIXI.AnimatedSprite} and by
* {@link PIXI.VideoResource} to update animation frames / video textures.
*
* It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.
*
* The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.
* Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.
*
* @example

@@ -717,3 +803,2 @@ * let ticker = PIXI.Ticker.shared;

* let stage = new PIXI.Container();
* let interactionManager = PIXI.interaction.InteractionManager(renderer);
* document.body.appendChild(renderer.view);

@@ -751,2 +836,25 @@ * ticker.add(function (time) {

/**
* The system ticker instance used by {@link PIXI.interaction.InteractionManager} and by
* {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,
* unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.
*
* The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.
*
* @member {PIXI.Ticker}
* @static
*/
staticAccessors.system.get = function ()
{
if (!Ticker._system)
{
var system = Ticker._system = new Ticker();
system.autoStart = true;
system._protected = true;
}
return Ticker._system;
};
Object.defineProperties( Ticker.prototype, prototypeAccessors );

@@ -757,2 +865,3 @@ Object.defineProperties( Ticker, staticAccessors );

* Middleware for for Application Ticker.
*
* @example

@@ -762,2 +871,3 @@ * import {TickerPlugin} from '@pixi/ticker';

* Application.registerPlugin(TickerPlugin);
*
* @class

@@ -801,2 +911,3 @@ * @memberof PIXI

* Convenience method for stopping the render.
*
* @method PIXI.Application#stop

@@ -810,2 +921,3 @@ */

* Convenience method for starting the render.
*
* @method PIXI.Application#start

@@ -818,3 +930,4 @@ */

/**
* Internal reference to the ticker
* Internal reference to the ticker.
*
* @type {PIXI.Ticker}

@@ -829,2 +942,3 @@ * @name _ticker

* Ticker for doing render updates.
*
* @type {PIXI.Ticker}

@@ -845,3 +959,4 @@ * @name ticker

/**
* Clean up the ticker, scoped to application
* Clean up the ticker, scoped to application.
*
* @static

@@ -848,0 +963,0 @@ * @private

/*!
* @pixi/ticker - v5.0.0-alpha.3
* Compiled Tue, 03 Jul 2018 04:08:21 UTC
* @pixi/ticker - v5.0.0-rc
* Compiled Fri, 01 Feb 2019 04:50:10 UTC
*

@@ -18,2 +18,3 @@ * @pixi/ticker is licensed under the MIT License.

* @static
* @name TARGET_FPMS
* @memberof PIXI.settings

@@ -64,2 +65,3 @@ * @type {number}

* The handler function to execute.
* @private
* @member {Function}

@@ -71,2 +73,3 @@ */

* The calling to execute.
* @private
* @member {Function}

@@ -78,2 +81,3 @@ */

* The current priority.
* @private
* @member {number}

@@ -85,2 +89,3 @@ */

* If this should only execute once.
* @private
* @member {boolean}

@@ -92,2 +97,3 @@ */

* The next item in chain.
* @private
* @member {TickerListener}

@@ -99,2 +105,3 @@ */

* The previous item in chain.
* @private
* @member {TickerListener}

@@ -114,3 +121,3 @@ */

* Simple compare function to figure out if a function and context match.
*
* @private
* @param {Function} fn - The listener function to be added for one update

@@ -129,2 +136,3 @@ * @param {Function} context - The listener context

* Emit by calling the current function.
* @private
* @param {number} deltaTime - time since the last emit.

@@ -166,2 +174,3 @@ * @return {TickerListener} Next ticker

* Connect to the list.
* @private
* @param {TickerListener} previous - Input node, previous listener

@@ -182,2 +191,3 @@ */

* Destroy and don't use after this.
* @private
* @param {boolean} [hard = false] `true` to remove the `next` reference, this

@@ -218,7 +228,6 @@ * is considered a hard destroy. Soft destroy maintains the next reference.

* A Ticker class that runs an update loop that other objects listen to.
* This class is composed around listeners
* meant for execution on the next requested animation frame.
* Animation frames are requested only when necessary,
* e.g. When the ticker is started and the emitter has listeners.
*
* This class is composed around listeners meant for execution on the next requested animation frame.
* Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.
*
* @class

@@ -240,2 +249,3 @@ * @memberof PIXI

* Internal current frame request ID
* @type {?number}
* @private

@@ -248,2 +258,3 @@ */

* This is the maximum allowed milliseconds between updates.
* @type {number}
* @private

@@ -254,2 +265,9 @@ */

/**
* Internal value managed by maxFPS property setter and getter.
* This is the minimum allowed milliseconds between updates.
* @private
*/
this._minElapsedMS = 0;
/**
* Whether or not this ticker should invoke the method

@@ -276,2 +294,16 @@ * {@link PIXI.Ticker#start} automatically

/**
* Scaler time elapsed in milliseconds from last frame to this frame.
* This value is capped by setting {@link PIXI.Ticker#minFPS}
* and is scaled with {@link PIXI.Ticker#speed}.
* **Note:** The cap may be exceeded by scaling.
* If the platform supports DOMHighResTimeStamp,
* this value will have a precision of 1 µs.
* Defaults to target frame time
*
* @member {number}
* @default 16.66
*/
this.deltaMS = 1 / settings.settings.TARGET_FPMS;
/**
* Time elapsed in milliseconds from last frame to this frame.

@@ -361,4 +393,4 @@ * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}

var prototypeAccessors = { FPS: { configurable: true },minFPS: { configurable: true } };
var staticAccessors = { shared: { configurable: true } };
var prototypeAccessors = { FPS: { configurable: true },minFPS: { configurable: true },maxFPS: { configurable: true } };
var staticAccessors = { shared: { configurable: true },system: { configurable: true } };

@@ -593,3 +625,2 @@ /**

{
var this$1 = this;
if ( currentTime === void 0 ) currentTime = performance.now();

@@ -625,4 +656,16 @@

this.deltaTime = elapsedMS * settings.settings.TARGET_FPMS * this.speed;
elapsedMS *= this.speed;
// if not enough time has passed, exit the function.
// We give an extra ms to elapsedMS for this check, because the nature of
// request animation frame means that not all browsers will return precise values.
// However, because rAF works based on v-sync, it's won't change the effective FPS.
if (this._minElapsedMS && elapsedMS + 1 < this._minElapsedMS)
{
return;
}
this.deltaMS = elapsedMS;
this.deltaTime = this.deltaMS * settings.settings.TARGET_FPMS;
// Cache a local reference, in-case ticker is destroyed

@@ -637,3 +680,3 @@ // during the emit, we can still check for head.next

{
listener = listener.emit(this$1.deltaTime);
listener = listener.emit(this.deltaTime);
}

@@ -648,3 +691,3 @@

{
this.deltaTime = this.elapsedMS = 0;
this.deltaTime = this.deltaMS = this.elapsedMS = 0;
}

@@ -688,5 +731,8 @@

{
// Clamp: 0 to TARGET_FPMS
var minFPMS = Math.min(Math.max(0, fps) / 1000, settings.settings.TARGET_FPMS);
// Minimum must be below the maxFPS
var minFPS = Math.min(this.maxFPS, fps);
// Must be at least 0, but below 1 / settings.TARGET_FPMS
var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.settings.TARGET_FPMS);
this._maxElapsedMS = 1 / minFPMS;

@@ -696,8 +742,48 @@ };

/**
* The shared ticker instance used by {@link PIXI.AnimatedSprite}.
* and by {@link PIXI.interaction.InteractionManager}.
* The property {@link PIXI.Ticker#autoStart} is set to `true`
* for this instance. Please follow the examples for usage, including
* how to opt-out of auto-starting the shared ticker.
* Manages the minimum amount of milliseconds allowed to
* elapse between invoking {@link PIXI.Ticker#update}.
* This will effect the measured value of {@link PIXI.ticker.Ticker#FPS}.
* When setting this property it is clamped to a value between
* `1` and `TARGET_FPMS * 1000`.
*
* @member {number}
* @default 60
*/
prototypeAccessors.maxFPS.get = function ()
{
if (this._minElapsedMS)
{
return 1000 / this._minElapsedMS;
}
return settings.settings.TARGET_FPMS * 1000;
};
prototypeAccessors.maxFPS.set = function (fps)
{
if (fps / 1000 >= settings.settings.TARGET_FPMS)
{
this._minElapsedMS = 0;
}
else
{
// Max must be at least the minFPS
var maxFPS = Math.max(this.minFPS, fps);
// Must be at least 1, but below 1 / settings.TARGET_FPMS
var maxFPMS = Math.min(Math.max(1, maxFPS) / 1000, settings.settings.TARGET_FPMS);
this._minElapsedMS = 1 / maxFPMS;
}
};
/**
* The shared ticker instance used by {@link PIXI.AnimatedSprite} and by
* {@link PIXI.VideoResource} to update animation frames / video textures.
*
* It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.
*
* The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.
* Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.
*
* @example

@@ -718,3 +804,2 @@ * let ticker = PIXI.Ticker.shared;

* let stage = new PIXI.Container();
* let interactionManager = PIXI.interaction.InteractionManager(renderer);
* document.body.appendChild(renderer.view);

@@ -752,2 +837,25 @@ * ticker.add(function (time) {

/**
* The system ticker instance used by {@link PIXI.interaction.InteractionManager} and by
* {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,
* unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.
*
* The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.
*
* @member {PIXI.Ticker}
* @static
*/
staticAccessors.system.get = function ()
{
if (!Ticker._system)
{
var system = Ticker._system = new Ticker();
system.autoStart = true;
system._protected = true;
}
return Ticker._system;
};
Object.defineProperties( Ticker.prototype, prototypeAccessors );

@@ -758,2 +866,3 @@ Object.defineProperties( Ticker, staticAccessors );

* Middleware for for Application Ticker.
*
* @example

@@ -763,2 +872,3 @@ * import {TickerPlugin} from '@pixi/ticker';

* Application.registerPlugin(TickerPlugin);
*
* @class

@@ -802,2 +912,3 @@ * @memberof PIXI

* Convenience method for stopping the render.
*
* @method PIXI.Application#stop

@@ -811,2 +922,3 @@ */

* Convenience method for starting the render.
*
* @method PIXI.Application#start

@@ -819,3 +931,4 @@ */

/**
* Internal reference to the ticker
* Internal reference to the ticker.
*
* @type {PIXI.Ticker}

@@ -830,2 +943,3 @@ * @name _ticker

* Ticker for doing render updates.
*
* @type {PIXI.Ticker}

@@ -846,3 +960,4 @@ * @name ticker

/**
* Clean up the ticker, scoped to application
* Clean up the ticker, scoped to application.
*
* @static

@@ -849,0 +964,0 @@ * @private

11

package.json
{
"name": "@pixi/ticker",
"version": "5.0.0-alpha.3",
"version": "5.0.0-rc",
"main": "lib/ticker.js",
"module": "lib/ticker.es.js",
"description": "PixiJS Application",
"description": "Tickers are control the timings within PixiJS",
"author": "Mat Groves",

@@ -28,7 +28,8 @@ "contributors": [

"dependencies": {
"@pixi/settings": "^5.0.0-alpha.3"
"@pixi/settings": "^5.0.0-rc"
},
"devDependencies": {
"floss": "^2.1.3"
}
"floss": "^2.1.5"
},
"gitHead": "9026a1bbca9a9d86b7a3b6d5eb4fa2c3145c2b85"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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