File tree 4 files changed +9
-4
lines changed
4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @firebase/firestore " : patch
3
+ ---
4
+
5
+ Use 'pagehide' for page termination by default.
Original file line number Diff line number Diff line change @@ -966,7 +966,7 @@ export class IndexedDbPersistence implements Persistence {
966
966
return this . shutdown ( ) ;
967
967
} ) ;
968
968
} ;
969
- this . window . addEventListener ( 'unload ' , this . windowUnloadHandler ) ;
969
+ this . window . addEventListener ( 'pagehide ' , this . windowUnloadHandler ) ;
970
970
}
971
971
}
972
972
@@ -976,7 +976,7 @@ export class IndexedDbPersistence implements Persistence {
976
976
typeof this . window ?. removeEventListener === 'function' ,
977
977
"Expected 'window.removeEventListener' to be a function"
978
978
) ;
979
- this . window ! . removeEventListener ( 'unload ' , this . windowUnloadHandler ) ;
979
+ this . window ! . removeEventListener ( 'pagehide ' , this . windowUnloadHandler ) ;
980
980
this . windowUnloadHandler = null ;
981
981
}
982
982
}
Original file line number Diff line number Diff line change @@ -613,7 +613,7 @@ export class WebStorageSharedClientState implements SharedClientState {
613
613
614
614
// Register a window unload hook to remove the client metadata entry from
615
615
// WebStorage even if `shutdown()` was not called.
616
- this . window . addEventListener ( 'unload ' , ( ) => this . shutdown ( ) ) ;
616
+ this . window . addEventListener ( 'pagehide ' , ( ) => this . shutdown ( ) ) ;
617
617
618
618
this . started = true ;
619
619
}
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ export class FakeWindow implements WindowLike {
58
58
case 'storage' :
59
59
this . storageListeners . push ( listener ) ;
60
60
break ;
61
- case 'unload ' :
61
+ case 'pagehide ' :
62
62
case 'visibilitychange' :
63
63
// The spec tests currently do not rely on `unload`/`visibilitychange`
64
64
// listeners.
You can’t perform that action at this time.
0 commit comments