UNPKG

1.41 kBJavaScriptView Raw
1import { ExtensionType, extensions } from '@pixi/extensions';
2import { deprecation } from '@pixi/utils';
3
4class PluginSystem {
5 constructor(renderer) {
6 this.renderer = renderer;
7 this.plugins = {};
8 Object.defineProperties(this.plugins, {
9 extract: {
10 enumerable: false,
11 get() {
12 deprecation("7.0.0", "renderer.plugins.extract has moved to renderer.extract");
13 return renderer.extract;
14 }
15 },
16 prepare: {
17 enumerable: false,
18 get() {
19 deprecation("7.0.0", "renderer.plugins.prepare has moved to renderer.prepare");
20 return renderer.prepare;
21 }
22 },
23 interaction: {
24 enumerable: false,
25 get() {
26 deprecation("7.0.0", "renderer.plugins.interaction has been deprecated, use renderer.events");
27 return renderer.events;
28 }
29 }
30 });
31 }
32 init() {
33 const staticMap = this.rendererPlugins;
34 for (const o in staticMap) {
35 this.plugins[o] = new staticMap[o](this.renderer);
36 }
37 }
38 destroy() {
39 for (const o in this.plugins) {
40 this.plugins[o].destroy();
41 this.plugins[o] = null;
42 }
43 }
44}
45PluginSystem.extension = {
46 type: [
47 ExtensionType.RendererSystem,
48 ExtensionType.CanvasRendererSystem
49 ],
50 name: "_plugin"
51};
52extensions.add(PluginSystem);
53
54export { PluginSystem };
55//# sourceMappingURL=PluginSystem.mjs.map