regl-web-components 0.0.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundler/esbuild.build.mjs +9 -0
- package/bundler/esbuild.config.mjs +1 -0
- package/bundler/esbuild.watch.mjs +1 -0
- package/dist/all-define.cjs +10322 -0
- package/dist/all.cjs +10333 -0
- package/dist/all.js +61 -60
- package/dist/deferred-regl.cjs +201 -0
- package/dist/deferred-regl.js +181 -0
- package/dist/regl-element-define.cjs +9789 -0
- package/dist/regl-element.cjs +9853 -0
- package/dist/regl-multi-element-define.cjs +10011 -0
- package/dist/regl-multi-element.cjs +10021 -0
- package/dist/regl-multi-root-define.cjs +10086 -0
- package/dist/regl-multi-root.cjs +10095 -0
- package/package.json +12 -2
- package/src/all-define.ts +0 -7
- package/src/all.ts +0 -3
- package/src/deferred-regl.ts +0 -142
- package/src/multi-regl.ts +0 -283
- package/src/regl-element-define.ts +0 -2
- package/src/regl-element.ts +0 -31
- package/src/regl-multi-element-define.ts +0 -2
- package/src/regl-multi-element.ts +0 -69
- package/src/regl-multi-root-define.ts +0 -2
- package/src/regl-multi-root.ts +0 -80
- package/src/regl-wc-initialization-options.ts +0 -48
package/dist/all.js
CHANGED
|
@@ -9777,65 +9777,6 @@ var require_regl = __commonJS({
|
|
|
9777
9777
|
}
|
|
9778
9778
|
});
|
|
9779
9779
|
|
|
9780
|
-
// src/regl-element.ts
|
|
9781
|
-
var import_regl = __toESM(require_regl());
|
|
9782
|
-
|
|
9783
|
-
// src/regl-wc-initialization-options.ts
|
|
9784
|
-
var regl_wc_initialization_options_default = reglWcInitializationOptions;
|
|
9785
|
-
function reglWcInitializationOptions(element) {
|
|
9786
|
-
const optionsAttrJson = element.getAttribute("initializationOptions");
|
|
9787
|
-
const optionsFromAttrs = [
|
|
9788
|
-
{
|
|
9789
|
-
attribute: "canvas",
|
|
9790
|
-
getValue: (id) => document.getElementById(id)
|
|
9791
|
-
},
|
|
9792
|
-
{
|
|
9793
|
-
attribute: "container",
|
|
9794
|
-
getValue: (id) => document.getElementById(id)
|
|
9795
|
-
},
|
|
9796
|
-
{
|
|
9797
|
-
attribute: "pixelRatio",
|
|
9798
|
-
getValue: (attr) => +attr
|
|
9799
|
-
}
|
|
9800
|
-
].map((spec) => {
|
|
9801
|
-
const attr = element.getAttribute(spec.attribute);
|
|
9802
|
-
if (attr) return { [spec.attribute]: spec.getValue(attr) };
|
|
9803
|
-
return null;
|
|
9804
|
-
}).filter((v) => !!v).reduce((accum, kv) => {
|
|
9805
|
-
return {
|
|
9806
|
-
...accum,
|
|
9807
|
-
...kv
|
|
9808
|
-
};
|
|
9809
|
-
}, {});
|
|
9810
|
-
const options = {
|
|
9811
|
-
...optionsAttrJson ? JSON.parse(optionsAttrJson) : {},
|
|
9812
|
-
...optionsFromAttrs,
|
|
9813
|
-
...element.reglInitializationOptions
|
|
9814
|
-
};
|
|
9815
|
-
return {
|
|
9816
|
-
...options,
|
|
9817
|
-
...!options.container && !options.canvas ? { container: element } : {}
|
|
9818
|
-
};
|
|
9819
|
-
}
|
|
9820
|
-
|
|
9821
|
-
// src/regl-element.ts
|
|
9822
|
-
var ReglElement = class extends HTMLElement {
|
|
9823
|
-
regl;
|
|
9824
|
-
get reglInitializationOptions() {
|
|
9825
|
-
return {};
|
|
9826
|
-
}
|
|
9827
|
-
createRegl() {
|
|
9828
|
-
const options = regl_wc_initialization_options_default(this);
|
|
9829
|
-
this.regl = (0, import_regl.default)(options);
|
|
9830
|
-
}
|
|
9831
|
-
connectedCallback() {
|
|
9832
|
-
this.createRegl();
|
|
9833
|
-
}
|
|
9834
|
-
disconnectedCallback() {
|
|
9835
|
-
this?.regl?.destroy();
|
|
9836
|
-
}
|
|
9837
|
-
};
|
|
9838
|
-
|
|
9839
9780
|
// src/deferred-regl.ts
|
|
9840
9781
|
var deferred_regl_default = deferredRegl;
|
|
9841
9782
|
function deferredRegl() {
|
|
@@ -10014,6 +9955,65 @@ function falsy(x) {
|
|
|
10014
9955
|
return x === null || x === void 0;
|
|
10015
9956
|
}
|
|
10016
9957
|
|
|
9958
|
+
// src/regl-element.ts
|
|
9959
|
+
var import_regl = __toESM(require_regl());
|
|
9960
|
+
|
|
9961
|
+
// src/regl-wc-initialization-options.ts
|
|
9962
|
+
var regl_wc_initialization_options_default = reglWcInitializationOptions;
|
|
9963
|
+
function reglWcInitializationOptions(element) {
|
|
9964
|
+
const optionsAttrJson = element.getAttribute("initializationOptions");
|
|
9965
|
+
const optionsFromAttrs = [
|
|
9966
|
+
{
|
|
9967
|
+
attribute: "canvas",
|
|
9968
|
+
getValue: (id) => document.getElementById(id)
|
|
9969
|
+
},
|
|
9970
|
+
{
|
|
9971
|
+
attribute: "container",
|
|
9972
|
+
getValue: (id) => document.getElementById(id)
|
|
9973
|
+
},
|
|
9974
|
+
{
|
|
9975
|
+
attribute: "pixelRatio",
|
|
9976
|
+
getValue: (attr) => +attr
|
|
9977
|
+
}
|
|
9978
|
+
].map((spec) => {
|
|
9979
|
+
const attr = element.getAttribute(spec.attribute);
|
|
9980
|
+
if (attr) return { [spec.attribute]: spec.getValue(attr) };
|
|
9981
|
+
return null;
|
|
9982
|
+
}).filter((v) => !!v).reduce((accum, kv) => {
|
|
9983
|
+
return {
|
|
9984
|
+
...accum,
|
|
9985
|
+
...kv
|
|
9986
|
+
};
|
|
9987
|
+
}, {});
|
|
9988
|
+
const options = {
|
|
9989
|
+
...optionsAttrJson ? JSON.parse(optionsAttrJson) : {},
|
|
9990
|
+
...optionsFromAttrs,
|
|
9991
|
+
...element.reglInitializationOptions
|
|
9992
|
+
};
|
|
9993
|
+
return {
|
|
9994
|
+
...options,
|
|
9995
|
+
...!options.container && !options.canvas ? { container: element } : {}
|
|
9996
|
+
};
|
|
9997
|
+
}
|
|
9998
|
+
|
|
9999
|
+
// src/regl-element.ts
|
|
10000
|
+
var ReglElement = class extends HTMLElement {
|
|
10001
|
+
regl;
|
|
10002
|
+
get reglInitializationOptions() {
|
|
10003
|
+
return {};
|
|
10004
|
+
}
|
|
10005
|
+
createRegl() {
|
|
10006
|
+
const options = regl_wc_initialization_options_default(this);
|
|
10007
|
+
this.regl = (0, import_regl.default)(options);
|
|
10008
|
+
}
|
|
10009
|
+
connectedCallback() {
|
|
10010
|
+
this.createRegl();
|
|
10011
|
+
}
|
|
10012
|
+
disconnectedCallback() {
|
|
10013
|
+
this?.regl?.destroy();
|
|
10014
|
+
}
|
|
10015
|
+
};
|
|
10016
|
+
|
|
10017
10017
|
// src/regl-multi-root.ts
|
|
10018
10018
|
var import_regl2 = __toESM(require_regl());
|
|
10019
10019
|
|
|
@@ -10319,5 +10319,6 @@ var ReglMultiElement = class extends HTMLElement {
|
|
|
10319
10319
|
export {
|
|
10320
10320
|
ReglElement,
|
|
10321
10321
|
ReglMultiElement,
|
|
10322
|
-
ReglMultiRoot
|
|
10322
|
+
ReglMultiRoot,
|
|
10323
|
+
deferredRegl
|
|
10323
10324
|
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/deferred-regl.ts
|
|
20
|
+
var deferred_regl_exports = {};
|
|
21
|
+
__export(deferred_regl_exports, {
|
|
22
|
+
default: () => deferred_regl_default,
|
|
23
|
+
deferredRegl: () => deferredRegl
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(deferred_regl_exports);
|
|
26
|
+
var deferred_regl_default = deferredRegl;
|
|
27
|
+
function deferredRegl() {
|
|
28
|
+
var regl = null;
|
|
29
|
+
var queue = [];
|
|
30
|
+
var def = dfn("()");
|
|
31
|
+
unset();
|
|
32
|
+
def.setRegl = function(r) {
|
|
33
|
+
regl = r;
|
|
34
|
+
if (!r) return unset();
|
|
35
|
+
for (var i = 0; i < queue.length; i++) {
|
|
36
|
+
queue[i](regl);
|
|
37
|
+
}
|
|
38
|
+
queue = null;
|
|
39
|
+
def.frame = r.frame;
|
|
40
|
+
def.draw = r.draw;
|
|
41
|
+
def.poll = r.poll;
|
|
42
|
+
def.clear = r.clear;
|
|
43
|
+
def.buffer = r.buffer;
|
|
44
|
+
def.texture = r.texture;
|
|
45
|
+
def.elements = r.elements;
|
|
46
|
+
def.framebuffer = r.framebuffer;
|
|
47
|
+
def.framebufferCube = r.framebufferCube;
|
|
48
|
+
def.renderbuffer = r.renderbuffer;
|
|
49
|
+
def.cube = r.cube;
|
|
50
|
+
def.read = r.read;
|
|
51
|
+
def.hasExtension = r.hasExtension;
|
|
52
|
+
def.limits = r.limits;
|
|
53
|
+
def.stats = r.limits;
|
|
54
|
+
def.now = r.now;
|
|
55
|
+
def.destroy = r.destroy;
|
|
56
|
+
def.on = r.on;
|
|
57
|
+
};
|
|
58
|
+
return def;
|
|
59
|
+
function unset() {
|
|
60
|
+
if (!queue) queue = [];
|
|
61
|
+
def.frame = function(cb) {
|
|
62
|
+
queue.push(function(r) {
|
|
63
|
+
r.frame(cb);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
def.draw = function(cb) {
|
|
67
|
+
queue.push(function(r) {
|
|
68
|
+
r.draw(cb);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
def.poll = function() {
|
|
72
|
+
queue.push(function(r) {
|
|
73
|
+
r.poll();
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
def.clear = function(opts) {
|
|
77
|
+
queue.push(function(r) {
|
|
78
|
+
r.clear(opts);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
def.prop = function(key) {
|
|
82
|
+
return function(context, props) {
|
|
83
|
+
if (!falsy(props[key])) {
|
|
84
|
+
return props[key];
|
|
85
|
+
} else {
|
|
86
|
+
var matches = key.match(/(?<prop>.+)\[(?<index>.+)\]/i);
|
|
87
|
+
if (matches) {
|
|
88
|
+
return props[matches.groups.prop][matches.groups.index];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
def.props = def.prop;
|
|
94
|
+
def.context = function(key) {
|
|
95
|
+
return function(context, props) {
|
|
96
|
+
return context[key];
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
def["this"] = function(key) {
|
|
100
|
+
return function(context, props) {
|
|
101
|
+
return this[key];
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
def.buffer = dfn("buffer");
|
|
105
|
+
def.texture = dfn("texture");
|
|
106
|
+
def.elements = dfn("elements");
|
|
107
|
+
def.framebuffer = dfnx("framebuffer", ["resize", "use"]);
|
|
108
|
+
def.framebufferCube = dfn("framebufferCube");
|
|
109
|
+
def.renderbuffer = dfn("renderbuffer");
|
|
110
|
+
def.cube = dfn("cube");
|
|
111
|
+
def.read = function() {
|
|
112
|
+
};
|
|
113
|
+
def.hasExtension = function() {
|
|
114
|
+
};
|
|
115
|
+
def.limits = function() {
|
|
116
|
+
};
|
|
117
|
+
def.stats = function() {
|
|
118
|
+
};
|
|
119
|
+
def.now = function() {
|
|
120
|
+
return 0;
|
|
121
|
+
};
|
|
122
|
+
def.destroy = function() {
|
|
123
|
+
queue.push(function(r) {
|
|
124
|
+
r.destroy();
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
def.on = function(name, f) {
|
|
128
|
+
queue.push(function(r) {
|
|
129
|
+
r.on(name, f);
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function dfn(key) {
|
|
134
|
+
return function(opts) {
|
|
135
|
+
if (key === "()" && regl) return regl(opts);
|
|
136
|
+
else if (regl) return regl[key](opts);
|
|
137
|
+
var f = null;
|
|
138
|
+
if (key === "()") {
|
|
139
|
+
queue.push(function(r) {
|
|
140
|
+
f = r(opts);
|
|
141
|
+
});
|
|
142
|
+
} else {
|
|
143
|
+
queue.push(function(r) {
|
|
144
|
+
f = r[key](opts);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return function() {
|
|
148
|
+
var args = arguments;
|
|
149
|
+
if (!falsy(f)) {
|
|
150
|
+
if (key === "()") f.apply(null, args);
|
|
151
|
+
else return f;
|
|
152
|
+
} else {
|
|
153
|
+
queue.push(function(r) {
|
|
154
|
+
f.apply(null, args);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function dfnx(key, methods) {
|
|
161
|
+
return function(opts) {
|
|
162
|
+
if (key === "()" && regl) return regl(opts);
|
|
163
|
+
else if (regl) return regl[key](opts);
|
|
164
|
+
var f = null;
|
|
165
|
+
if (key === "()") {
|
|
166
|
+
queue.push(function(r2) {
|
|
167
|
+
f = r2(opts);
|
|
168
|
+
});
|
|
169
|
+
} else {
|
|
170
|
+
queue.push(function(r2) {
|
|
171
|
+
f = r2[key](opts);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
var r = function() {
|
|
175
|
+
var args = arguments;
|
|
176
|
+
if (!falsy(f)) {
|
|
177
|
+
if (key === "()") f.apply(null, args);
|
|
178
|
+
else return f;
|
|
179
|
+
} else {
|
|
180
|
+
queue.push(function(r2) {
|
|
181
|
+
f.apply(null, args);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
for (var i = 0; i < methods.length; i++) {
|
|
186
|
+
var m = methods[i];
|
|
187
|
+
r[m] = function() {
|
|
188
|
+
var args = arguments;
|
|
189
|
+
if (!falsy(f)) return f[m].apply(f, args);
|
|
190
|
+
else queue.push(function() {
|
|
191
|
+
f[m].apply(f, args);
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return r;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function falsy(x) {
|
|
200
|
+
return x === null || x === void 0;
|
|
201
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// src/deferred-regl.ts
|
|
2
|
+
var deferred_regl_default = deferredRegl;
|
|
3
|
+
function deferredRegl() {
|
|
4
|
+
var regl = null;
|
|
5
|
+
var queue = [];
|
|
6
|
+
var def = dfn("()");
|
|
7
|
+
unset();
|
|
8
|
+
def.setRegl = function(r) {
|
|
9
|
+
regl = r;
|
|
10
|
+
if (!r) return unset();
|
|
11
|
+
for (var i = 0; i < queue.length; i++) {
|
|
12
|
+
queue[i](regl);
|
|
13
|
+
}
|
|
14
|
+
queue = null;
|
|
15
|
+
def.frame = r.frame;
|
|
16
|
+
def.draw = r.draw;
|
|
17
|
+
def.poll = r.poll;
|
|
18
|
+
def.clear = r.clear;
|
|
19
|
+
def.buffer = r.buffer;
|
|
20
|
+
def.texture = r.texture;
|
|
21
|
+
def.elements = r.elements;
|
|
22
|
+
def.framebuffer = r.framebuffer;
|
|
23
|
+
def.framebufferCube = r.framebufferCube;
|
|
24
|
+
def.renderbuffer = r.renderbuffer;
|
|
25
|
+
def.cube = r.cube;
|
|
26
|
+
def.read = r.read;
|
|
27
|
+
def.hasExtension = r.hasExtension;
|
|
28
|
+
def.limits = r.limits;
|
|
29
|
+
def.stats = r.limits;
|
|
30
|
+
def.now = r.now;
|
|
31
|
+
def.destroy = r.destroy;
|
|
32
|
+
def.on = r.on;
|
|
33
|
+
};
|
|
34
|
+
return def;
|
|
35
|
+
function unset() {
|
|
36
|
+
if (!queue) queue = [];
|
|
37
|
+
def.frame = function(cb) {
|
|
38
|
+
queue.push(function(r) {
|
|
39
|
+
r.frame(cb);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
def.draw = function(cb) {
|
|
43
|
+
queue.push(function(r) {
|
|
44
|
+
r.draw(cb);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
def.poll = function() {
|
|
48
|
+
queue.push(function(r) {
|
|
49
|
+
r.poll();
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
def.clear = function(opts) {
|
|
53
|
+
queue.push(function(r) {
|
|
54
|
+
r.clear(opts);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
def.prop = function(key) {
|
|
58
|
+
return function(context, props) {
|
|
59
|
+
if (!falsy(props[key])) {
|
|
60
|
+
return props[key];
|
|
61
|
+
} else {
|
|
62
|
+
var matches = key.match(/(?<prop>.+)\[(?<index>.+)\]/i);
|
|
63
|
+
if (matches) {
|
|
64
|
+
return props[matches.groups.prop][matches.groups.index];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
def.props = def.prop;
|
|
70
|
+
def.context = function(key) {
|
|
71
|
+
return function(context, props) {
|
|
72
|
+
return context[key];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
def["this"] = function(key) {
|
|
76
|
+
return function(context, props) {
|
|
77
|
+
return this[key];
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
def.buffer = dfn("buffer");
|
|
81
|
+
def.texture = dfn("texture");
|
|
82
|
+
def.elements = dfn("elements");
|
|
83
|
+
def.framebuffer = dfnx("framebuffer", ["resize", "use"]);
|
|
84
|
+
def.framebufferCube = dfn("framebufferCube");
|
|
85
|
+
def.renderbuffer = dfn("renderbuffer");
|
|
86
|
+
def.cube = dfn("cube");
|
|
87
|
+
def.read = function() {
|
|
88
|
+
};
|
|
89
|
+
def.hasExtension = function() {
|
|
90
|
+
};
|
|
91
|
+
def.limits = function() {
|
|
92
|
+
};
|
|
93
|
+
def.stats = function() {
|
|
94
|
+
};
|
|
95
|
+
def.now = function() {
|
|
96
|
+
return 0;
|
|
97
|
+
};
|
|
98
|
+
def.destroy = function() {
|
|
99
|
+
queue.push(function(r) {
|
|
100
|
+
r.destroy();
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
def.on = function(name, f) {
|
|
104
|
+
queue.push(function(r) {
|
|
105
|
+
r.on(name, f);
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function dfn(key) {
|
|
110
|
+
return function(opts) {
|
|
111
|
+
if (key === "()" && regl) return regl(opts);
|
|
112
|
+
else if (regl) return regl[key](opts);
|
|
113
|
+
var f = null;
|
|
114
|
+
if (key === "()") {
|
|
115
|
+
queue.push(function(r) {
|
|
116
|
+
f = r(opts);
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
queue.push(function(r) {
|
|
120
|
+
f = r[key](opts);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return function() {
|
|
124
|
+
var args = arguments;
|
|
125
|
+
if (!falsy(f)) {
|
|
126
|
+
if (key === "()") f.apply(null, args);
|
|
127
|
+
else return f;
|
|
128
|
+
} else {
|
|
129
|
+
queue.push(function(r) {
|
|
130
|
+
f.apply(null, args);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function dfnx(key, methods) {
|
|
137
|
+
return function(opts) {
|
|
138
|
+
if (key === "()" && regl) return regl(opts);
|
|
139
|
+
else if (regl) return regl[key](opts);
|
|
140
|
+
var f = null;
|
|
141
|
+
if (key === "()") {
|
|
142
|
+
queue.push(function(r2) {
|
|
143
|
+
f = r2(opts);
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
queue.push(function(r2) {
|
|
147
|
+
f = r2[key](opts);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
var r = function() {
|
|
151
|
+
var args = arguments;
|
|
152
|
+
if (!falsy(f)) {
|
|
153
|
+
if (key === "()") f.apply(null, args);
|
|
154
|
+
else return f;
|
|
155
|
+
} else {
|
|
156
|
+
queue.push(function(r2) {
|
|
157
|
+
f.apply(null, args);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
for (var i = 0; i < methods.length; i++) {
|
|
162
|
+
var m = methods[i];
|
|
163
|
+
r[m] = function() {
|
|
164
|
+
var args = arguments;
|
|
165
|
+
if (!falsy(f)) return f[m].apply(f, args);
|
|
166
|
+
else queue.push(function() {
|
|
167
|
+
f[m].apply(f, args);
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return r;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function falsy(x) {
|
|
176
|
+
return x === null || x === void 0;
|
|
177
|
+
}
|
|
178
|
+
export {
|
|
179
|
+
deferred_regl_default as default,
|
|
180
|
+
deferredRegl
|
|
181
|
+
};
|