@alexgyver/component 1.3.0 → 1.3.1
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/Component.js +0 -19
- package/package.json +1 -1
package/Component.js
CHANGED
|
@@ -234,23 +234,4 @@ export class SVG {
|
|
|
234
234
|
static text = (text, x, y, attrs = {}, props = {}) => SVG._make('text', { ...attrs, x: x, y: y }, { ...props, text: text });
|
|
235
235
|
|
|
236
236
|
static _make = (tag, attrs = {}, props = {}) => Component.makeSVG(tag, { attrs: { ...attrs }, ...props });
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
export async function waitRender(elm, cb = null, ctx = window) {
|
|
240
|
-
return new Promise(res => {
|
|
241
|
-
let e = elm;
|
|
242
|
-
while (e.parentNode) e = e.parentNode;
|
|
243
|
-
if (e instanceof Document) {
|
|
244
|
-
if (cb) cb(elm);
|
|
245
|
-
res(elm);
|
|
246
|
-
}
|
|
247
|
-
const obs = new MutationObserver((mut) => {
|
|
248
|
-
if (mut[0].addedNodes.length === 0) return;
|
|
249
|
-
if (Array.prototype.indexOf.call(mut[0].addedNodes, e) === -1) return;
|
|
250
|
-
obs.disconnect();
|
|
251
|
-
if (cb) cb(elm);
|
|
252
|
-
res(elm);
|
|
253
|
-
});
|
|
254
|
-
obs.observe(ctx.document.body, { childList: true, subtree: true });
|
|
255
|
-
});
|
|
256
237
|
}
|