File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
packages/web/src/worker/sync Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -69,19 +69,18 @@ export class WorkerClient {
6969 * When the client tab is closed, its lock will be returned. So when the shared worker attempts to acquire the lock,
7070 * it can consider the connection to be closed.
7171 */
72- addLockBasedCloseSignal ( name : string ) {
72+ async addLockBasedCloseSignal ( name : string ) {
7373 if ( ! this . resolvedPortPromise ) {
7474 // The init logic above is actually synchronous, so this should not happen.
7575 this . sync . broadCastLogger . warn ( 'addLockBasedCloseSignal called before port promise registered' ) ;
7676 } else {
77- this . resolvedPortPromise . then ( ( wrappedPort ) => {
78- /**
79- * The client registered a navigator lock. We now can guarantee detecting if the client has closed.
80- * E.g. before this point: It's possible some ports might have been created and closed before the
81- * lock based close signal is added. We should not trust those ports.
82- */
83- wrappedPort . isProtectedFromClose = true ;
84- } ) ;
77+ const wrappedPort = await this . resolvedPortPromise ;
78+ /**
79+ * The client registered a navigator lock. We now can guarantee detecting if the client has closed.
80+ * E.g. before this point: It's possible some ports might have been created and closed before the
81+ * lock based close signal is added. We should not trust those ports.
82+ */
83+ wrappedPort . isProtectedFromClose = true ;
8584 }
8685 getNavigatorLocks ( ) . request ( name , async ( ) => {
8786 await this . removePort ( ) ;
You can’t perform that action at this time.
0 commit comments