1 | "use strict";
|
2 | var runner = require("@pixi/runner");
|
3 | class Resource {
|
4 | |
5 |
|
6 |
|
7 |
|
8 | constructor(width = 0, height = 0) {
|
9 | this._width = width, this._height = height, this.destroyed = !1, this.internal = !1, this.onResize = new runner.Runner("setRealSize"), this.onUpdate = new runner.Runner("update"), this.onError = new runner.Runner("onError");
|
10 | }
|
11 | |
12 |
|
13 |
|
14 |
|
15 | bind(baseTexture) {
|
16 | this.onResize.add(baseTexture), this.onUpdate.add(baseTexture), this.onError.add(baseTexture), (this._width || this._height) && this.onResize.emit(this._width, this._height);
|
17 | }
|
18 | |
19 |
|
20 |
|
21 |
|
22 | unbind(baseTexture) {
|
23 | this.onResize.remove(baseTexture), this.onUpdate.remove(baseTexture), this.onError.remove(baseTexture);
|
24 | }
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 | resize(width, height) {
|
31 | (width !== this._width || height !== this._height) && (this._width = width, this._height = height, this.onResize.emit(width, height));
|
32 | }
|
33 | |
34 |
|
35 |
|
36 |
|
37 | get valid() {
|
38 | return !!this._width && !!this._height;
|
39 | }
|
40 |
|
41 | update() {
|
42 | this.destroyed || this.onUpdate.emit();
|
43 | }
|
44 | |
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | load() {
|
51 | return Promise.resolve(this);
|
52 | }
|
53 | |
54 |
|
55 |
|
56 |
|
57 | get width() {
|
58 | return this._width;
|
59 | }
|
60 | |
61 |
|
62 |
|
63 |
|
64 | get height() {
|
65 | return this._height;
|
66 | }
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | style(_renderer, _baseTexture, _glTexture) {
|
75 | return !1;
|
76 | }
|
77 |
|
78 | dispose() {
|
79 | }
|
80 | |
81 |
|
82 |
|
83 |
|
84 |
|
85 | destroy() {
|
86 | this.destroyed || (this.destroyed = !0, this.dispose(), this.onError.removeAll(), this.onError = null, this.onResize.removeAll(), this.onResize = null, this.onUpdate.removeAll(), this.onUpdate = null);
|
87 | }
|
88 | |
89 |
|
90 |
|
91 |
|
92 |
|
93 | static test(_source, _extension) {
|
94 | return !1;
|
95 | }
|
96 | }
|
97 | exports.Resource = Resource;
|
98 |
|