@pixi/ticker
Advanced tools
Comparing version 5.0.0-alpha.2 to 5.0.0-alpha.3
/*! | ||
* @pixi/ticker - v5.0.0-alpha.2 | ||
* Compiled Sat, 17 Mar 2018 17:48:48 UTC | ||
* @pixi/ticker - v5.0.0-alpha.3 | ||
* Compiled Tue, 03 Jul 2018 04:08:21 UTC | ||
* | ||
@@ -192,3 +192,3 @@ * @pixi/ticker is licensed under the MIT License. | ||
// Redirect to the next item | ||
var redirect = this.previous; | ||
var redirect = this.next; | ||
@@ -728,3 +728,102 @@ // Remove references | ||
export { Ticker, UPDATE_PRIORITY }; | ||
/** | ||
* Middleware for for Application Ticker. | ||
* @example | ||
* import {TickerPlugin} from '@pixi/ticker'; | ||
* import {Application} from '@pixi/app'; | ||
* Application.registerPlugin(TickerPlugin); | ||
* @class | ||
* @memberof PIXI | ||
*/ | ||
var TickerPlugin = function TickerPlugin () {}; | ||
TickerPlugin.init = function init (options) | ||
{ | ||
var this$1 = this; | ||
// Set default | ||
options = Object.assign({ | ||
autoStart: true, | ||
sharedTicker: false, | ||
}, options); | ||
// Create ticker setter | ||
Object.defineProperty(this, 'ticker', | ||
{ | ||
set: function set(ticker) | ||
{ | ||
if (this._ticker) | ||
{ | ||
this._ticker.remove(this.render, this); | ||
} | ||
this._ticker = ticker; | ||
if (ticker) | ||
{ | ||
ticker.add(this.render, this, UPDATE_PRIORITY.LOW); | ||
} | ||
}, | ||
get: function get() | ||
{ | ||
return this._ticker; | ||
}, | ||
}); | ||
/** | ||
* Convenience method for stopping the render. | ||
* @method PIXI.Application#stop | ||
*/ | ||
this.stop = function () { | ||
this$1._ticker.stop(); | ||
}; | ||
/** | ||
* Convenience method for starting the render. | ||
* @method PIXI.Application#start | ||
*/ | ||
this.start = function () { | ||
this$1._ticker.start(); | ||
}; | ||
/** | ||
* Internal reference to the ticker | ||
* @type {PIXI.Ticker} | ||
* @name _ticker | ||
* @memberof PIXI.Application# | ||
* @private | ||
*/ | ||
this._ticker = null; | ||
/** | ||
* Ticker for doing render updates. | ||
* @type {PIXI.Ticker} | ||
* @name ticker | ||
* @memberof PIXI.Application# | ||
* @default PIXI.Ticker.shared | ||
*/ | ||
this.ticker = options.sharedTicker ? Ticker.shared : new Ticker(); | ||
// Start the rendering | ||
if (options.autoStart) | ||
{ | ||
this.start(); | ||
} | ||
}; | ||
/** | ||
* Clean up the ticker, scoped to application | ||
* @static | ||
* @private | ||
*/ | ||
TickerPlugin.destroy = function destroy () | ||
{ | ||
if (this._ticker) | ||
{ | ||
var oldTicker = this._ticker; | ||
this.ticker = null; | ||
oldTicker.destroy(); | ||
} | ||
}; | ||
export { Ticker, TickerPlugin, UPDATE_PRIORITY }; | ||
//# sourceMappingURL=ticker.es.js.map |
/*! | ||
* @pixi/ticker - v5.0.0-alpha.2 | ||
* Compiled Sat, 17 Mar 2018 17:48:48 UTC | ||
* @pixi/ticker - v5.0.0-alpha.3 | ||
* Compiled Tue, 03 Jul 2018 04:08:21 UTC | ||
* | ||
@@ -196,3 +196,3 @@ * @pixi/ticker is licensed under the MIT License. | ||
// Redirect to the next item | ||
var redirect = this.previous; | ||
var redirect = this.next; | ||
@@ -732,4 +732,104 @@ // Remove references | ||
/** | ||
* Middleware for for Application Ticker. | ||
* @example | ||
* import {TickerPlugin} from '@pixi/ticker'; | ||
* import {Application} from '@pixi/app'; | ||
* Application.registerPlugin(TickerPlugin); | ||
* @class | ||
* @memberof PIXI | ||
*/ | ||
var TickerPlugin = function TickerPlugin () {}; | ||
TickerPlugin.init = function init (options) | ||
{ | ||
var this$1 = this; | ||
// Set default | ||
options = Object.assign({ | ||
autoStart: true, | ||
sharedTicker: false, | ||
}, options); | ||
// Create ticker setter | ||
Object.defineProperty(this, 'ticker', | ||
{ | ||
set: function set(ticker) | ||
{ | ||
if (this._ticker) | ||
{ | ||
this._ticker.remove(this.render, this); | ||
} | ||
this._ticker = ticker; | ||
if (ticker) | ||
{ | ||
ticker.add(this.render, this, UPDATE_PRIORITY.LOW); | ||
} | ||
}, | ||
get: function get() | ||
{ | ||
return this._ticker; | ||
}, | ||
}); | ||
/** | ||
* Convenience method for stopping the render. | ||
* @method PIXI.Application#stop | ||
*/ | ||
this.stop = function () { | ||
this$1._ticker.stop(); | ||
}; | ||
/** | ||
* Convenience method for starting the render. | ||
* @method PIXI.Application#start | ||
*/ | ||
this.start = function () { | ||
this$1._ticker.start(); | ||
}; | ||
/** | ||
* Internal reference to the ticker | ||
* @type {PIXI.Ticker} | ||
* @name _ticker | ||
* @memberof PIXI.Application# | ||
* @private | ||
*/ | ||
this._ticker = null; | ||
/** | ||
* Ticker for doing render updates. | ||
* @type {PIXI.Ticker} | ||
* @name ticker | ||
* @memberof PIXI.Application# | ||
* @default PIXI.Ticker.shared | ||
*/ | ||
this.ticker = options.sharedTicker ? Ticker.shared : new Ticker(); | ||
// Start the rendering | ||
if (options.autoStart) | ||
{ | ||
this.start(); | ||
} | ||
}; | ||
/** | ||
* Clean up the ticker, scoped to application | ||
* @static | ||
* @private | ||
*/ | ||
TickerPlugin.destroy = function destroy () | ||
{ | ||
if (this._ticker) | ||
{ | ||
var oldTicker = this._ticker; | ||
this.ticker = null; | ||
oldTicker.destroy(); | ||
} | ||
}; | ||
exports.Ticker = Ticker; | ||
exports.TickerPlugin = TickerPlugin; | ||
exports.UPDATE_PRIORITY = UPDATE_PRIORITY; | ||
//# sourceMappingURL=ticker.js.map |
{ | ||
"name": "@pixi/ticker", | ||
"version": "5.0.0-alpha.2", | ||
"version": "5.0.0-alpha.3", | ||
"main": "lib/ticker.js", | ||
@@ -28,3 +28,3 @@ "module": "lib/ticker.es.js", | ||
"dependencies": { | ||
"@pixi/settings": "^5.0.0-alpha.2" | ||
"@pixi/settings": "^5.0.0-alpha.3" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
@@ -11,4 +11,21 @@ # @pixi/ticker | ||
Create a Ticker object directly: | ||
```js | ||
import * as ticker from '@pixi/ticker'; | ||
import { Ticker } from '@pixi/ticker'; | ||
const ticker = new Ticker(); | ||
ticker.start(); | ||
``` | ||
Use as an Application plugin: | ||
```js | ||
import { TickerPlugin } from '@pixi/ticker'; | ||
import { Application } from '@pixi/app'; | ||
Application.registerPlugin(TickerPlugin); | ||
const app = new Application(); | ||
app.ticker.start(); | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
111962
1474
30