How to communicate between multiple windows of the same chrome app?

前端 未结 2 948
别跟我提以往
别跟我提以往 2020-12-16 05:58

When using chrome developer tools, it appears that each app window (and the background \'page\') has its own javascript context (space of objects, thread of execution), and

2条回答
  •  甜味超标
    2020-12-16 06:38

    You might find the chrome.app.window.getAll() and chrome.app.window.get() methods useful. They are however new to Chrome 33 which is not yet in the stable channel.

    As an alternative you could hold an array of opened AppWindow objects in the background page context.

    You can then get a reference to the background page context from any window using the chrome.runtime.getBackgroundPage() method

提交回复
热议问题