Skip to content

Commit c282bac

Browse files
authored
Merge pull request #1625 from frontlich/feat/option-exclude-rewrite-iframe-constructor
feat: 新增excludeRewriteIframeConstructor配置项支持排除指定构造函数重写
2 parents 0064a91 + 3c4fdc8 commit c282bac

File tree

5 files changed

+39
-8
lines changed

5 files changed

+39
-8
lines changed

Contact.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11

22
欢迎小伙伴们加入micro-app微信群交流^ ^
3-
![IMG_3507](https://github.com/user-attachments/assets/209b49de-019f-4b21-9b5c-8516dfd26127)
3+
![f08d41cdea5a364a9277d443e90f2f25](https://github.com/user-attachments/assets/47bf5fcb-60a6-48b5-81e1-31302e10b1e9)
4+
5+
6+
7+
8+
9+
欢迎小伙伴们加入micro-app-DevTools开发交流群^ ^
10+
![5795b83d20722041992bc38f6917f25d](https://github.com/user-attachments/assets/bdfc12e8-982a-4772-8d80-82dc23ec1647)
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
423

524

625

docs/zh-cn/advanced.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
```

docs/zh-cn/micro-app-devtools.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# 📖简介
22
`Micro-App-DevTools`是基于京东零售推出的一款为`micro-app`框架而开发的`chrome`插件,旨在方便开发者对微前端进行数据查看以及调试,提升工作效率。
3-
Github 地址为:[https://github.com/micro-zoe/micro-app-chrome-plugin](https://github.com/micro-zoe/micro-app-chrome-plugin),欢迎 Star 一下
43

54
# 如何使用
65

7-
在chrome中输入`chrome://extensions`打开扩展程序,打开[插件下载地址](https://github.com/micro-zoe/micro-app-chrome-plugin/releases),选择最新Release包的`micro-app-chrome-plugin.zip`
6+
在chrome中输入`chrome://extensions`打开扩展程序,打开[插件下载地址](https://github.com/jd-opensource/micro-app-chrome-plugin/releases),选择最新Release包的`micro-app-chrome-plugin.zip`
87
文件下载,无需解压,将已下载的插件拖入。
98

109
![扩展程序](https://img12.360buyimg.com/imagetools/jfs/t1/119438/16/38287/53001/646b50e3F9012f2e8/3bba9844bbb1431b.png)
@@ -49,7 +48,7 @@ Github 地址为:[https://github.com/micro-zoe/micro-app-chrome-plugin](https:
4948
#### 快捷打开方式二
5049
点击鼠标右键,选择micro-app下,二级菜单点子应用开发环境模拟
5150

52-
![快捷方式](https://github.com/micro-zoe/micro-app-chrome-plugin/assets/14011130/91b40f7c-a826-4ffe-8c20-0b43a5c3bc6f)
51+
![快捷方式](https://github.com/jd-opensource/micro-app-chrome-plugin/assets/14011130/91b40f7c-a826-4ffe-8c20-0b43a5c3bc6f)
5352

5453

5554
## 常见问题
@@ -61,8 +60,7 @@ Github 地址为:[https://github.com/micro-zoe/micro-app-chrome-plugin](https:
6160

6261
## 🤝 参与共建
6362

64-
如果您对这个项目感兴趣,欢迎提[pull request](https://github.com/micro-zoe/micro-app-chrome-plugin/pulls)参与贡献,也欢迎 [Star](https://github.com/micro-zoe/micro-app-chrome-plugin) 支持一下 ^_^
65-
欢迎小伙伴们加入`Micro-App-DevTools`微信群交流^ ^
63+
如果您对这个项目感兴趣,欢迎提[pull request](https://github.com/jd-opensource/micro-app-chrome-plugin/pulls)参与贡献,也欢迎 [Star](https://github.com/jd-opensource/micro-app-chrome-plugin) 支持一下 ^_^
6664

67-
![image](https://img12.360buyimg.com/imagetools/jfs/t1/29962/13/20207/70265/646c9851Fe104e7c1/fed2ab97e2cf5f29.png)
65+
[欢迎小伙伴们加入Micro-App微信群交流^ ^](https://github.com/jd-opensource/micro-app/blob/master/Contact.md)
6866

src/sandbox/iframe/window.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff 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,

typings/global.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)