File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -102,4 +102,12 @@ microApp.start({
102102 disableIframeRootDocument: true
103103})
104104```
105+ ## 7、excludeRewriteIframeConstructor : iframe模式下排除对指定构造函数的Symbol.hasInstance属性重写
106+ ``` js
107+ import microApp from ' @micro-zoe/micro-app'
105108
109+ microApp .start ({
110+ // iframe模式下,不对事件对象的原型判断进行代理
111+ excludeRewriteIframeConstructor: [' EventTarget' ]
112+ })
113+ ```
Original file line number Diff line number Diff line change @@ -94,7 +94,12 @@ function patchWindowProperty (
9494 * 4. native url instanceof iframe window.URL
9595 * ...
9696 */
97- if ( isConstructor ( microAppWindow [ key ] ) && key in rawWindow && ! UN_PROXY_INSTANCEOF_KEYS . includes ( key ) ) {
97+ if (
98+ isConstructor ( microAppWindow [ key ] ) &&
99+ key in rawWindow &&
100+ ! UN_PROXY_INSTANCEOF_KEYS . includes ( key ) &&
101+ ! microApp . options . excludeRewriteIframeConstructor ?. includes ( key )
102+ ) {
98103 rawDefineProperty ( microAppWindow [ key ] , Symbol . hasInstance , {
99104 configurable : true ,
100105 enumerable : false ,
Original file line number Diff line number Diff line change @@ -372,6 +372,7 @@ declare module '@micro-app/types' {
372372 inheritBaseBody ?:boolean ,
373373 escapeIframeWindowEvents ? : Array < string > ,
374374 disableIframeRootDocument ?: boolean ,
375+ excludeRewriteIframeConstructor ?: string [ ]
375376 }
376377
377378 // MicroApp config
You can’t perform that action at this time.
0 commit comments