37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$app$TickerPlugin = function(global, require, module, exports) {
|
|
global = require("module$node_modules$pixi_DOT_js$lib$extensions$Extensions");
|
|
var _const = require("module$node_modules$pixi_DOT_js$lib$ticker$const"), Ticker = require("module$node_modules$pixi_DOT_js$lib$ticker$Ticker");
|
|
"use strict";
|
|
class TickerPlugin {
|
|
static init(options) {
|
|
options = Object.assign({autoStart:!0, sharedTicker:!1}, options);
|
|
Object.defineProperty(this, "ticker", {configurable:!0, set(ticker) {
|
|
this._ticker && this._ticker.remove(this.render, this);
|
|
(this._ticker = ticker) && ticker.add(this.render, this, _const.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.Ticker.shared : new Ticker.Ticker();
|
|
options.autoStart && this.start();
|
|
}
|
|
static destroy() {
|
|
if (this._ticker) {
|
|
const oldTicker = this._ticker;
|
|
this.ticker = null;
|
|
oldTicker.destroy();
|
|
}
|
|
}
|
|
}
|
|
TickerPlugin.extension = global.ExtensionType.Application;
|
|
exports.TickerPlugin = TickerPlugin;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$app$TickerPlugin.js.map
|