Yes it halts everything, a (dedicated) worker can't outlive its owner. If you use a shared worker, which can have multiple owners, the worker will only stay alive as long as at least one owner is alive. This is the case even if you pass on the entangled MessagePort
to another window (i.e. owner of the message port is not the owner of the worker).
So, with shared workers you can "transfer" the ownership by opening a new window that establishes its own connection with the worker (with new SharedWorker(...)
) and then close the old window. But one window must always remain open.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…