garfish icon indicating copy to clipboard operation
garfish copied to clipboard

Garfish vm sandbox support dom 0 event

Open zhoushaw opened this issue 3 years ago • 0 comments

Describe the bug

// 独立运行可以正常触发回调,在微前端环境无法正常触发
window.onmessage = function () {
 // 可以正常获取微前端应用回调
}

暂时解决方案

将 dom 零级事件转换成,addEventListener

window.addEventListener('message',() => {

})

Reproduction

https://github.com/modern-js-dev/garfish/tree/main/dev

Used Package Manager

pnpm

System Info

System:
    OS: macOS 11.6
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 310.52 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.18.3 - ~/.nvm/versions/node/v14.18.3/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v14.18.3/bin/npm
  Browsers:
    Chrome: 100.0.4896.88
    Safari: 14.1.2
  npmPackages:
    garfish: 1.5.2

Validations

zhoushaw avatar Apr 24 '22 04:04 zhoushaw