@alicloud/alfa-react 1.5.16 → 1.6.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/es/createApplication.js +24 -12
- package/es/version.js +1 -1
- package/lib/createApplication.js +24 -12
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/types/types/index.d.ts +4 -0
- package/types/version.d.ts +1 -1
package/es/createApplication.js
CHANGED
|
@@ -99,7 +99,8 @@ export default function createApplication(loader) {
|
|
|
99
99
|
syncResourceGroup = props.syncResourceGroup,
|
|
100
100
|
basename = props.basename,
|
|
101
101
|
channel = props.channel,
|
|
102
|
-
onSyncHistory = props.onSyncHistory
|
|
102
|
+
onSyncHistory = props.onSyncHistory,
|
|
103
|
+
delay = props.delay;
|
|
103
104
|
var handleExternalLink = customProps.handleExternalLink;
|
|
104
105
|
var _useState = useState(null),
|
|
105
106
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -271,11 +272,22 @@ export default function createApplication(loader) {
|
|
|
271
272
|
case 0:
|
|
272
273
|
countRegister(memoOptions.name);
|
|
273
274
|
fakeBody = memoOptions.container || appRef.current || document.body;
|
|
274
|
-
|
|
275
|
+
if (!delay) {
|
|
276
|
+
_context.next = 5;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
_context.next = 5;
|
|
280
|
+
return new Promise(function (resolve) {
|
|
281
|
+
setTimeout(function () {
|
|
282
|
+
resolve(undefined);
|
|
283
|
+
}, delay);
|
|
284
|
+
});
|
|
285
|
+
case 5:
|
|
286
|
+
_context.next = 7;
|
|
275
287
|
return loader.register(_objectSpread(_objectSpread({}, memoOptions), {}, {
|
|
276
288
|
container: fakeBody
|
|
277
289
|
}));
|
|
278
|
-
case
|
|
290
|
+
case 7:
|
|
279
291
|
_yield$loader$registe = _context.sent;
|
|
280
292
|
app = _yield$loader$registe.app;
|
|
281
293
|
logger = _yield$loader$registe.logger;
|
|
@@ -285,29 +297,29 @@ export default function createApplication(loader) {
|
|
|
285
297
|
|
|
286
298
|
// container has been unmounted
|
|
287
299
|
if (!isUnmounted) {
|
|
288
|
-
_context.next =
|
|
300
|
+
_context.next = 15;
|
|
289
301
|
break;
|
|
290
302
|
}
|
|
291
303
|
return _context.abrupt("return");
|
|
292
|
-
case
|
|
304
|
+
case 15:
|
|
293
305
|
if (app) {
|
|
294
|
-
_context.next =
|
|
306
|
+
_context.next = 17;
|
|
295
307
|
break;
|
|
296
308
|
}
|
|
297
309
|
return _context.abrupt("return", (logger === null || logger === void 0 ? void 0 : logger.error) && logger.error({
|
|
298
310
|
E_CODE: 'RuntimeError',
|
|
299
311
|
E_MSG: 'load app failed.'
|
|
300
312
|
}));
|
|
301
|
-
case
|
|
313
|
+
case 17:
|
|
302
314
|
if (appRef.current) {
|
|
303
|
-
_context.next =
|
|
315
|
+
_context.next = 19;
|
|
304
316
|
break;
|
|
305
317
|
}
|
|
306
318
|
return _context.abrupt("return", (logger === null || logger === void 0 ? void 0 : logger.error) && logger.error({
|
|
307
319
|
E_CODE: 'RuntimeError',
|
|
308
320
|
E_MSG: 'cannot find container.'
|
|
309
321
|
}));
|
|
310
|
-
case
|
|
322
|
+
case 19:
|
|
311
323
|
// update body in sandbox context
|
|
312
324
|
(_app$context$updateBo = (_app$context = app.context).updateBody) === null || _app$context$updateBo === void 0 ? void 0 : _app$context$updateBo.call(_app$context, memoOptions.sandbox.disableFakeBody ? document.body : fakeBody);
|
|
313
325
|
_ref2 = memoOptions.props, path = _ref2.path;
|
|
@@ -346,11 +358,11 @@ export default function createApplication(loader) {
|
|
|
346
358
|
};
|
|
347
359
|
}
|
|
348
360
|
}
|
|
349
|
-
_context.next =
|
|
361
|
+
_context.next = 25;
|
|
350
362
|
return app.mount(fakeBody, {
|
|
351
363
|
customProps: customProps
|
|
352
364
|
});
|
|
353
|
-
case
|
|
365
|
+
case 25:
|
|
354
366
|
(logger === null || logger === void 0 ? void 0 : logger.record) && (logger === null || logger === void 0 ? void 0 : logger.record({
|
|
355
367
|
END_TIME: Date.now()
|
|
356
368
|
}));
|
|
@@ -362,7 +374,7 @@ export default function createApplication(loader) {
|
|
|
362
374
|
|
|
363
375
|
// just run once
|
|
364
376
|
setAppInstance(app);
|
|
365
|
-
case
|
|
377
|
+
case 29:
|
|
366
378
|
case "end":
|
|
367
379
|
return _context.stop();
|
|
368
380
|
}
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.
|
|
1
|
+
export var version = '1.6.1';
|
package/lib/createApplication.js
CHANGED
|
@@ -109,7 +109,8 @@ function createApplication(loader) {
|
|
|
109
109
|
syncResourceGroup = props.syncResourceGroup,
|
|
110
110
|
basename = props.basename,
|
|
111
111
|
channel = props.channel,
|
|
112
|
-
onSyncHistory = props.onSyncHistory
|
|
112
|
+
onSyncHistory = props.onSyncHistory,
|
|
113
|
+
delay = props.delay;
|
|
113
114
|
var handleExternalLink = customProps.handleExternalLink;
|
|
114
115
|
var _useState = (0, _react.useState)(null),
|
|
115
116
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -281,11 +282,22 @@ function createApplication(loader) {
|
|
|
281
282
|
case 0:
|
|
282
283
|
(0, _counter.countRegister)(memoOptions.name);
|
|
283
284
|
fakeBody = memoOptions.container || appRef.current || document.body;
|
|
284
|
-
|
|
285
|
+
if (!delay) {
|
|
286
|
+
_context.next = 5;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
_context.next = 5;
|
|
290
|
+
return new Promise(function (resolve) {
|
|
291
|
+
setTimeout(function () {
|
|
292
|
+
resolve(undefined);
|
|
293
|
+
}, delay);
|
|
294
|
+
});
|
|
295
|
+
case 5:
|
|
296
|
+
_context.next = 7;
|
|
285
297
|
return loader.register(_objectSpread(_objectSpread({}, memoOptions), {}, {
|
|
286
298
|
container: fakeBody
|
|
287
299
|
}));
|
|
288
|
-
case
|
|
300
|
+
case 7:
|
|
289
301
|
_yield$loader$registe = _context.sent;
|
|
290
302
|
app = _yield$loader$registe.app;
|
|
291
303
|
logger = _yield$loader$registe.logger;
|
|
@@ -295,29 +307,29 @@ function createApplication(loader) {
|
|
|
295
307
|
|
|
296
308
|
// container has been unmounted
|
|
297
309
|
if (!isUnmounted) {
|
|
298
|
-
_context.next =
|
|
310
|
+
_context.next = 15;
|
|
299
311
|
break;
|
|
300
312
|
}
|
|
301
313
|
return _context.abrupt("return");
|
|
302
|
-
case
|
|
314
|
+
case 15:
|
|
303
315
|
if (app) {
|
|
304
|
-
_context.next =
|
|
316
|
+
_context.next = 17;
|
|
305
317
|
break;
|
|
306
318
|
}
|
|
307
319
|
return _context.abrupt("return", (logger === null || logger === void 0 ? void 0 : logger.error) && logger.error({
|
|
308
320
|
E_CODE: 'RuntimeError',
|
|
309
321
|
E_MSG: 'load app failed.'
|
|
310
322
|
}));
|
|
311
|
-
case
|
|
323
|
+
case 17:
|
|
312
324
|
if (appRef.current) {
|
|
313
|
-
_context.next =
|
|
325
|
+
_context.next = 19;
|
|
314
326
|
break;
|
|
315
327
|
}
|
|
316
328
|
return _context.abrupt("return", (logger === null || logger === void 0 ? void 0 : logger.error) && logger.error({
|
|
317
329
|
E_CODE: 'RuntimeError',
|
|
318
330
|
E_MSG: 'cannot find container.'
|
|
319
331
|
}));
|
|
320
|
-
case
|
|
332
|
+
case 19:
|
|
321
333
|
// update body in sandbox context
|
|
322
334
|
(_app$context$updateBo = (_app$context = app.context).updateBody) === null || _app$context$updateBo === void 0 ? void 0 : _app$context$updateBo.call(_app$context, memoOptions.sandbox.disableFakeBody ? document.body : fakeBody);
|
|
323
335
|
_ref2 = memoOptions.props, path = _ref2.path;
|
|
@@ -356,11 +368,11 @@ function createApplication(loader) {
|
|
|
356
368
|
};
|
|
357
369
|
}
|
|
358
370
|
}
|
|
359
|
-
_context.next =
|
|
371
|
+
_context.next = 25;
|
|
360
372
|
return app.mount(fakeBody, {
|
|
361
373
|
customProps: customProps
|
|
362
374
|
});
|
|
363
|
-
case
|
|
375
|
+
case 25:
|
|
364
376
|
(logger === null || logger === void 0 ? void 0 : logger.record) && (logger === null || logger === void 0 ? void 0 : logger.record({
|
|
365
377
|
END_TIME: Date.now()
|
|
366
378
|
}));
|
|
@@ -372,7 +384,7 @@ function createApplication(loader) {
|
|
|
372
384
|
|
|
373
385
|
// just run once
|
|
374
386
|
setAppInstance(app);
|
|
375
|
-
case
|
|
387
|
+
case 29:
|
|
376
388
|
case "end":
|
|
377
389
|
return _context.stop();
|
|
378
390
|
}
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/alfa-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Alfa Framework (React Version)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"classnames": "^2.2.6",
|
|
39
39
|
"crypto-js": "^4.1.1",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
|
-
"@alicloud/alfa-core": "^1.4.
|
|
42
|
-
"@alicloud/console-os-loader": "^1.4.
|
|
41
|
+
"@alicloud/alfa-core": "^1.4.37",
|
|
42
|
+
"@alicloud/console-os-loader": "^1.4.36"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": ">=16.0.0"
|
package/types/types/index.d.ts
CHANGED
|
@@ -44,6 +44,10 @@ export interface AlfaFactoryOption extends IAppConfig {
|
|
|
44
44
|
* @deprecated
|
|
45
45
|
*/
|
|
46
46
|
fallbackRender?: (error?: Error) => Element;
|
|
47
|
+
/**
|
|
48
|
+
* 延迟加载
|
|
49
|
+
*/
|
|
50
|
+
delay?: number;
|
|
47
51
|
}
|
|
48
52
|
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
|
|
49
53
|
export type MicroApplication = ThenArg<ReturnType<typeof createMicroApp>>;
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.6.1";
|