Giter VIP home page Giter VIP logo

Comments (4)

jk4235 avatar jk4235 commented on July 4, 2024

我看了下,现在是把子应用的window.onxxx直接指向主应用的window.onxxx

这样多个子应用同时用到window.onxxx的话会有问题,没有隔离

为什么不直接挂在iframeWindow上呢?

此外可能需要在mount和unmount的时候手动处理一些事件了

from wujie.

yiludege avatar yiludege commented on July 4, 2024

@jk4235

不管挂哪里都是有问题的,比如:挂在 iframeWindow.onload上,iframe 是一开始就准备好的,子应用的 js 是 iframe ready 后注入的也就是说 js 里面的 window.onload 事件永远都不会触发,这个地方估计要框架维护一个针对 load 事件、domContentLoaded事件之类的事件列表,进行手动触发。

当然框架也提供了 plugin:windowAddEventListenerHook、windowPropertyOverride,用户可以自行 diy 这个地方

from wujie.

jk4235 avatar jk4235 commented on July 4, 2024

这个地方估计要框架维护一个针对 load 事件、domContentLoaded事件之类的事件列表,进行手动触发。

对,我的意思就是直接挂在iframeWindow上,然后手动在对应的生命周期里invoke,避免多个子应用互相干扰

from wujie.

yiludege avatar yiludege commented on July 4, 2024

明白,这个地方如果有兴趣可以 pr,我估计没这么快

from wujie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.