@zzdadelu/schema-builder 1.0.0-alpha.101 → 1.0.0-alpha.102
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/es/main.js +16 -63
- package/lib/main.js +16 -63
- package/package.json +1 -1
package/es/main.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["widgets", "settings"];
|
|
3
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
5
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
5
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
11
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
12
8
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
13
9
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
14
10
|
import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
@@ -19,7 +15,7 @@ var Design = function Design(props, ref) {
|
|
|
19
15
|
var widgets = props.widgets,
|
|
20
16
|
settings = props.settings,
|
|
21
17
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
22
|
-
var containerRef = useRef(
|
|
18
|
+
var containerRef = useRef();
|
|
23
19
|
useImperativeHandle(ref, function () {
|
|
24
20
|
return {
|
|
25
21
|
getValue: function getValue() {
|
|
@@ -36,69 +32,26 @@ var Design = function Design(props, ref) {
|
|
|
36
32
|
initIframe();
|
|
37
33
|
window.addEventListener('message', engineOnLoad);
|
|
38
34
|
return function () {
|
|
39
|
-
|
|
35
|
+
window.removeEventListener('message', engineOnLoad);
|
|
40
36
|
};
|
|
41
37
|
}, []);
|
|
42
38
|
var initIframe = function initIframe() {
|
|
43
|
-
var _containerRef$current;
|
|
44
39
|
iframe = createIframe();
|
|
45
|
-
|
|
40
|
+
containerRef.current.appendChild(iframe);
|
|
46
41
|
};
|
|
47
|
-
var engineOnLoad =
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// 等 iframe 加载完依赖
|
|
61
|
-
_context.n = 2;
|
|
62
|
-
return waitFor(function () {
|
|
63
|
-
var _iframe3, _iframe3$contentWindo;
|
|
64
|
-
return (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : (_iframe3$contentWindo = _iframe3.contentWindow) === null || _iframe3$contentWindo === void 0 ? void 0 : _iframe3$contentWindo.__FR_ENGINE__;
|
|
65
|
-
}, 10000);
|
|
66
|
-
case 2:
|
|
67
|
-
console.log("__FR_ENGINE__ ready, calling init()...");
|
|
68
|
-
iframe.contentWindow.__FR_ENGINE__.init(_objectSpread({
|
|
69
|
-
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
70
|
-
widgets: widgets,
|
|
71
|
-
logo: {
|
|
72
|
-
title: 'XRender'
|
|
73
|
-
}
|
|
74
|
-
}, restProps));
|
|
75
|
-
console.log('Engine initialization complete.');
|
|
76
|
-
case 3:
|
|
77
|
-
return _context.a(2);
|
|
78
|
-
}
|
|
79
|
-
}, _callee);
|
|
80
|
-
}));
|
|
81
|
-
return function engineOnLoad(_x) {
|
|
82
|
-
return _ref.apply(this, arguments);
|
|
83
|
-
};
|
|
84
|
-
}();
|
|
85
|
-
|
|
86
|
-
// 等待某个对象出现
|
|
87
|
-
var waitFor = function waitFor(conditionFn) {
|
|
88
|
-
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10000;
|
|
89
|
-
return new Promise(function (resolve, reject) {
|
|
90
|
-
var start = Date.now();
|
|
91
|
-
var timer = setInterval(function () {
|
|
92
|
-
var value = conditionFn();
|
|
93
|
-
if (value) {
|
|
94
|
-
clearInterval(timer);
|
|
95
|
-
resolve(value);
|
|
96
|
-
} else if (Date.now() - start >= timeout) {
|
|
97
|
-
clearInterval(timer);
|
|
98
|
-
reject(new Error("Timeout waiting for condition"));
|
|
99
|
-
}
|
|
100
|
-
}, 50);
|
|
101
|
-
});
|
|
42
|
+
var engineOnLoad = function engineOnLoad(event) {
|
|
43
|
+
var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
|
|
44
|
+
if (event.data.type !== 'engine-load') {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
(_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : (_iframe3$contentWindo = _iframe3.contentWindow) === null || _iframe3$contentWindo === void 0 ? void 0 : (_iframe3$contentWindo2 = _iframe3$contentWindo.__FR_ENGINE__) === null || _iframe3$contentWindo2 === void 0 ? void 0 : _iframe3$contentWindo2.init(_objectSpread({
|
|
48
|
+
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
49
|
+
widgets: widgets,
|
|
50
|
+
// recordEnable: true,
|
|
51
|
+
logo: {
|
|
52
|
+
title: 'XRender'
|
|
53
|
+
}
|
|
54
|
+
}, restProps));
|
|
102
55
|
};
|
|
103
56
|
return /*#__PURE__*/React.createElement("div", {
|
|
104
57
|
ref: containerRef,
|
package/lib/main.js
CHANGED
|
@@ -11,15 +11,11 @@ var defaultSetting = _interopRequireWildcard(require("./settings"));
|
|
|
11
11
|
var _excluded = ["widgets", "settings"];
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
15
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
16
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
16
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
20
18
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
22
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
23
19
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
24
20
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
25
21
|
var iframe;
|
|
@@ -27,7 +23,7 @@ var Design = function Design(props, ref) {
|
|
|
27
23
|
var widgets = props.widgets,
|
|
28
24
|
settings = props.settings,
|
|
29
25
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
30
|
-
var containerRef = (0, _react.useRef)(
|
|
26
|
+
var containerRef = (0, _react.useRef)();
|
|
31
27
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
32
28
|
return {
|
|
33
29
|
getValue: function getValue() {
|
|
@@ -44,69 +40,26 @@ var Design = function Design(props, ref) {
|
|
|
44
40
|
initIframe();
|
|
45
41
|
window.addEventListener('message', engineOnLoad);
|
|
46
42
|
return function () {
|
|
47
|
-
|
|
43
|
+
window.removeEventListener('message', engineOnLoad);
|
|
48
44
|
};
|
|
49
45
|
}, []);
|
|
50
46
|
var initIframe = function initIframe() {
|
|
51
|
-
var _containerRef$current;
|
|
52
47
|
iframe = (0, _createIframe.default)();
|
|
53
|
-
|
|
48
|
+
containerRef.current.appendChild(iframe);
|
|
54
49
|
};
|
|
55
|
-
var engineOnLoad =
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// 等 iframe 加载完依赖
|
|
69
|
-
_context.n = 2;
|
|
70
|
-
return waitFor(function () {
|
|
71
|
-
var _iframe3, _iframe3$contentWindo;
|
|
72
|
-
return (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : (_iframe3$contentWindo = _iframe3.contentWindow) === null || _iframe3$contentWindo === void 0 ? void 0 : _iframe3$contentWindo.__FR_ENGINE__;
|
|
73
|
-
}, 10000);
|
|
74
|
-
case 2:
|
|
75
|
-
console.log("__FR_ENGINE__ ready, calling init()...");
|
|
76
|
-
iframe.contentWindow.__FR_ENGINE__.init(_objectSpread({
|
|
77
|
-
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
78
|
-
widgets: widgets,
|
|
79
|
-
logo: {
|
|
80
|
-
title: 'XRender'
|
|
81
|
-
}
|
|
82
|
-
}, restProps));
|
|
83
|
-
console.log('Engine initialization complete.');
|
|
84
|
-
case 3:
|
|
85
|
-
return _context.a(2);
|
|
86
|
-
}
|
|
87
|
-
}, _callee);
|
|
88
|
-
}));
|
|
89
|
-
return function engineOnLoad(_x) {
|
|
90
|
-
return _ref.apply(this, arguments);
|
|
91
|
-
};
|
|
92
|
-
}();
|
|
93
|
-
|
|
94
|
-
// 等待某个对象出现
|
|
95
|
-
var waitFor = function waitFor(conditionFn) {
|
|
96
|
-
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10000;
|
|
97
|
-
return new Promise(function (resolve, reject) {
|
|
98
|
-
var start = Date.now();
|
|
99
|
-
var timer = setInterval(function () {
|
|
100
|
-
var value = conditionFn();
|
|
101
|
-
if (value) {
|
|
102
|
-
clearInterval(timer);
|
|
103
|
-
resolve(value);
|
|
104
|
-
} else if (Date.now() - start >= timeout) {
|
|
105
|
-
clearInterval(timer);
|
|
106
|
-
reject(new Error("Timeout waiting for condition"));
|
|
107
|
-
}
|
|
108
|
-
}, 50);
|
|
109
|
-
});
|
|
50
|
+
var engineOnLoad = function engineOnLoad(event) {
|
|
51
|
+
var _iframe3, _iframe3$contentWindo, _iframe3$contentWindo2;
|
|
52
|
+
if (event.data.type !== 'engine-load') {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
(_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : (_iframe3$contentWindo = _iframe3.contentWindow) === null || _iframe3$contentWindo === void 0 ? void 0 : (_iframe3$contentWindo2 = _iframe3$contentWindo.__FR_ENGINE__) === null || _iframe3$contentWindo2 === void 0 ? void 0 : _iframe3$contentWindo2.init(_objectSpread({
|
|
56
|
+
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
57
|
+
widgets: widgets,
|
|
58
|
+
// recordEnable: true,
|
|
59
|
+
logo: {
|
|
60
|
+
title: 'XRender'
|
|
61
|
+
}
|
|
62
|
+
}, restProps));
|
|
110
63
|
};
|
|
111
64
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
112
65
|
ref: containerRef,
|