🏁 fix clearInterval compatible bug in ie10 and ie11 (#1490)
Co-authored-by: Kuitos <kuitos.lau@gmail.com>
This commit is contained in:
parent
7ae60e3f7f
commit
6de0ac9721
|
|
@ -320,12 +320,13 @@ export async function loadApp<T extends ObjectType>(
|
||||||
unmountSandbox = sandboxContainer.unmount;
|
unmountSandbox = sandboxContainer.unmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { beforeUnmount = [], afterUnmount = [], afterMount = [], beforeMount = [], beforeLoad = [] } = mergeWith(
|
const {
|
||||||
{},
|
beforeUnmount = [],
|
||||||
getAddOns(global, assetPublicPath),
|
afterUnmount = [],
|
||||||
lifeCycles,
|
afterMount = [],
|
||||||
(v1, v2) => concat(v1 ?? [], v2 ?? []),
|
beforeMount = [],
|
||||||
);
|
beforeLoad = [],
|
||||||
|
} = mergeWith({}, getAddOns(global, assetPublicPath), lifeCycles, (v1, v2) => concat(v1 ?? [], v2 ?? []));
|
||||||
|
|
||||||
await execHooksChain(toArray(beforeLoad), app, global);
|
await execHooksChain(toArray(beforeLoad), app, global);
|
||||||
|
|
||||||
|
|
@ -338,11 +339,8 @@ export async function loadApp<T extends ObjectType>(
|
||||||
sandboxContainer?.instance?.latestSetProp,
|
sandboxContainer?.instance?.latestSetProp,
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const { onGlobalStateChange, setGlobalState, offGlobalStateChange }: Record<string, CallableFunction> =
|
||||||
onGlobalStateChange,
|
getMicroAppStateActions(appInstanceId);
|
||||||
setGlobalState,
|
|
||||||
offGlobalStateChange,
|
|
||||||
}: Record<string, CallableFunction> = getMicroAppStateActions(appInstanceId);
|
|
||||||
|
|
||||||
// FIXME temporary way
|
// FIXME temporary way
|
||||||
const syncAppWrapperElement2Sandbox = (element: HTMLElement | null) => (initialAppWrapperElement = element);
|
const syncAppWrapperElement2Sandbox = (element: HTMLElement | null) => (initialAppWrapperElement = element);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export default function patch(global: Window) {
|
||||||
|
|
||||||
global.clearInterval = (intervalId: number) => {
|
global.clearInterval = (intervalId: number) => {
|
||||||
intervals = intervals.filter((id) => id !== intervalId);
|
intervals = intervals.filter((id) => id !== intervalId);
|
||||||
return rawWindowClearInterval(intervalId);
|
return rawWindowClearInterval.call(window, intervalId as any);
|
||||||
};
|
};
|
||||||
|
|
||||||
global.setInterval = (handler: CallableFunction, timeout?: number, ...args: any[]) => {
|
global.setInterval = (handler: CallableFunction, timeout?: number, ...args: any[]) => {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ import { SandBoxType } from '../interfaces';
|
||||||
function iter(obj: typeof window, callbackFn: (prop: any) => void) {
|
function iter(obj: typeof window, callbackFn: (prop: any) => void) {
|
||||||
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
||||||
for (const prop in obj) {
|
for (const prop in obj) {
|
||||||
if (obj.hasOwnProperty(prop)) {
|
// patch for clearInterval for compatible reason, see #1490
|
||||||
|
if (obj.hasOwnProperty(prop) || prop === 'clearInterval') {
|
||||||
callbackFn(prop);
|
callbackFn(prop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user