本文介绍了Dart-隔离跨窗口通讯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dart隔离器是否可以进行跨窗口通信?这是我的情况:用户在浏览器窗口A中打开网站,窗口A产生一个新的隔离.然后,用户单击创建新选项卡的链接并打开浏览器窗口B(假设该链接位于同一域中,依此类推).浏览器窗口B可以从浏览器窗口A产生的隔离中发送和接收消息吗?如果是,怎么办?

Is cross-window communication possible with Dart isolates? Here is my scenario: User opens web site in browser window A and window A spawns a new isolate. The user then clicks a link that creates a new tab and opens browser window B (assume the link is in the same domain, etc...). Can browser window B send and receive messages from the isolate spawned by browser window A, and if so, how?

推荐答案

仅使用隔离消息传递就无法进行跨窗口通信.但是,您可以按照此处所述使用 postMessage 进行跨窗口通信.>,然后设置与每个隔离区进行通信的消息处理程序(通过使用postMessage作为每个隔离区之间的某种消息总线).

Cross window communication is not possible using isolates messaging alone. However you can do cross window communication using postMessage as described here and then set up message handlers that communicates with each isolate (there by using postMessage as a sort of message bus between each isolate).

这篇关于Dart-隔离跨窗口通讯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 23:34