Skip to content

Commit

Permalink
fix(1.0.0-beta.1): Solved the onmount error caused by closing the san…
Browse files Browse the repository at this point in the history
…dbox
  • Loading branch information
bailicangdu committed Mar 22, 2023
1 parent a6dc91b commit 11e0f8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/create_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ export default class CreateApp implements AppInterface {
}

private getMicroAppGlobalHook (eventName: string): Func | null {
const listener = (this.sandBox?.proxyWindow as Record<string, any>)[eventName]
const listener = (this.sandBox?.proxyWindow as Record<string, any>)?.[eventName]
return isFunction(listener) ? listener : null
}

Expand Down
4 changes: 2 additions & 2 deletions src/sandbox/iframe/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class IframeSandbox {
// TODO: 优化代码
// exec before initStaticGlobalKeys
this.createProxyLocation(appName, url, this.microAppWindow, childStaticLocation, browserHost, childHost)
this.createProxyWindow(appName, this.microAppWindow)
this.createProxyWindow(this.microAppWindow)
this.initStaticGlobalKeys(appName, url)
// get escapeProperties from plugins
this.getSpecialProperties(appName)
Expand Down Expand Up @@ -405,7 +405,7 @@ export default class IframeSandbox {
)
}

private createProxyWindow (appName: string, microAppWindow: microAppWindowType): void {
private createProxyWindow (microAppWindow: microAppWindowType): void {
const rawWindow = globalEnv.rawWindow
this.proxyWindow = new Proxy(microAppWindow, {
get: (target: microAppWindowType, key: PropertyKey): unknown => {
Expand Down

0 comments on commit 11e0f8e

Please sign in to comment.