@@ -49,13 +49,13 @@ import {
49
49
* invoke initialize() once before accessing any of the individual components.
50
50
*/
51
51
export abstract class ComponentProvider {
52
- protected persistence ! : Persistence ;
53
- protected sharedClientState ! : SharedClientState ;
54
- protected localStore ! : LocalStore ;
55
- protected syncEngine ! : SyncEngine ;
56
- protected gcScheduler ! : GarbageCollectionScheduler | null ;
57
- protected remoteStore ! : RemoteStore ;
58
- protected eventManager ! : EventManager ;
52
+ protected persistence ? : Persistence ;
53
+ protected sharedClientState ? : SharedClientState ;
54
+ protected localStore ? : LocalStore ;
55
+ protected syncEngine ? : SyncEngine ;
56
+ protected gcScheduler ? : GarbageCollectionScheduler | null ;
57
+ protected remoteStore ? : RemoteStore ;
58
+ protected eventManager ? : EventManager ;
59
59
60
60
abstract initialize (
61
61
asyncQueue : AsyncQueue ,
@@ -110,10 +110,10 @@ export abstract class ComponentProvider {
110
110
* Provides all components needed for Firestore with IndexedDB persistence.
111
111
*/
112
112
export class IndexedDbComponentProvider extends ComponentProvider {
113
- protected persistence ! : IndexedDbPersistence ;
114
- protected localStore ! : MultiTabLocalStore ;
115
- protected syncEngine ! : MultiTabSyncEngine ;
116
- protected gcScheduler ! : GarbageCollectionScheduler ;
113
+ protected persistence ? : IndexedDbPersistence ;
114
+ protected localStore ? : MultiTabLocalStore ;
115
+ protected syncEngine ? : MultiTabSyncEngine ;
116
+ protected gcScheduler ? : GarbageCollectionScheduler ;
117
117
118
118
async initialize (
119
119
asyncQueue : AsyncQueue ,
@@ -153,7 +153,7 @@ export class IndexedDbComponentProvider extends ComponentProvider {
153
153
)
154
154
: new MemorySharedClientState ( ) ;
155
155
this . sharedClientState . onlineStateHandler = onlineState =>
156
- this . syncEngine . applyOnlineStateChange (
156
+ this . syncEngine ! . applyOnlineStateChange (
157
157
onlineState ,
158
158
OnlineStateSource . SharedClientState
159
159
) ;
@@ -183,7 +183,7 @@ export class IndexedDbComponentProvider extends ComponentProvider {
183
183
datastore ,
184
184
asyncQueue ,
185
185
onlineState =>
186
- this . syncEngine . applyOnlineStateChange (
186
+ this . syncEngine ! . applyOnlineStateChange (
187
187
onlineState ,
188
188
OnlineStateSource . RemoteStore
189
189
) ,
@@ -207,12 +207,12 @@ export class IndexedDbComponentProvider extends ComponentProvider {
207
207
208
208
// NOTE: This will immediately call the listener, so we make sure to
209
209
// set it after localStore / remoteStore are started.
210
- await this . persistence ! . setPrimaryStateListener ( async isPrimary => {
211
- await this . syncEngine . applyPrimaryState ( isPrimary ) ;
212
- if ( isPrimary && ! this . gcScheduler . started ) {
213
- this . gcScheduler . start ( this . localStore ) ;
210
+ await this . persistence . setPrimaryStateListener ( async isPrimary => {
211
+ await this . syncEngine ! . applyPrimaryState ( isPrimary ) ;
212
+ if ( isPrimary && ! this . gcScheduler ! . started ) {
213
+ this . gcScheduler ! . start ( this . localStore ! ) ;
214
214
} else if ( ! isPrimary ) {
215
- this . gcScheduler . stop ( ) ;
215
+ this . gcScheduler ! . stop ( ) ;
216
216
}
217
217
} ) ;
218
218
}
@@ -269,7 +269,7 @@ export class MemoryComponentProvider extends ComponentProvider {
269
269
datastore ,
270
270
asyncQueue ,
271
271
onlineState =>
272
- this . syncEngine . applyOnlineStateChange (
272
+ this . syncEngine ! . applyOnlineStateChange (
273
273
onlineState ,
274
274
OnlineStateSource . RemoteStore
275
275
) ,
0 commit comments