[removed] How to know if a connection with a shared worker is still alive?

后端 未结 4 613
盖世英雄少女心
盖世英雄少女心 2021-02-01 16:47

I\'m trying to use a shared worker to maintain a list of all the windows/tabs of a web application. Therefore following code is used:

//lives in shared-worker.js         


        
4条回答
  •  执念已碎
    2021-02-01 17:04

    PortCollection would come in handy but doesn't seem to be implemented in any browser.

    It acts as an opaque array of MessagePort objects, thus allowing the objects to be garbage collected when they stop being relevant, while still allowing scripts to iterate over the MessagePort objects.

    source; http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#portcollection

    Edit; just rised an Issue for Chrome; http://crbug.com/263356

提交回复
热议问题