sdfsdfs
This commit is contained in:
65
node_modules/pixi.js/lib/app/TickerPlugin.mjs
generated
vendored
Normal file
65
node_modules/pixi.js/lib/app/TickerPlugin.mjs
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import { ExtensionType } from '../extensions/Extensions.mjs';
|
||||
import { UPDATE_PRIORITY } from '../ticker/const.mjs';
|
||||
import { Ticker } from '../ticker/Ticker.mjs';
|
||||
|
||||
"use strict";
|
||||
class TickerPlugin {
|
||||
/**
|
||||
* Initialize the plugin with scope of application instance
|
||||
* @static
|
||||
* @private
|
||||
* @param {object} [options] - See application options
|
||||
*/
|
||||
static init(options) {
|
||||
options = Object.assign({
|
||||
autoStart: true,
|
||||
sharedTicker: false
|
||||
}, options);
|
||||
Object.defineProperty(
|
||||
this,
|
||||
"ticker",
|
||||
{
|
||||
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() {
|
||||
return this._ticker;
|
||||
}
|
||||
}
|
||||
);
|
||||
this.stop = () => {
|
||||
this._ticker.stop();
|
||||
};
|
||||
this.start = () => {
|
||||
this._ticker.start();
|
||||
};
|
||||
this._ticker = null;
|
||||
this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();
|
||||
if (options.autoStart) {
|
||||
this.start();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Clean up the ticker, scoped to application.
|
||||
* @static
|
||||
* @private
|
||||
*/
|
||||
static destroy() {
|
||||
if (this._ticker) {
|
||||
const oldTicker = this._ticker;
|
||||
this.ticker = null;
|
||||
oldTicker.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
TickerPlugin.extension = ExtensionType.Application;
|
||||
|
||||
export { TickerPlugin };
|
||||
//# sourceMappingURL=TickerPlugin.mjs.map
|
Reference in New Issue
Block a user