(observer: QueryObserver<any, any, any, any, any>)
| 337 | } |
| 338 | |
| 339 | removeObserver(observer: QueryObserver<any, any, any, any, any>): void { |
| 340 | if (this.observers.indexOf(observer) !== -1) { |
| 341 | this.observers = this.observers.filter(x => x !== observer) |
| 342 | |
| 343 | if (!this.observers.length) { |
| 344 | // If the transport layer does not support cancellation |
| 345 | // we'll let the query continue so the result can be cached |
| 346 | if (this.retryer) { |
| 347 | if (this.retryer.isTransportCancelable || this.abortSignalConsumed) { |
| 348 | this.retryer.cancel({ revert: true }) |
| 349 | } else { |
| 350 | this.retryer.cancelRetry() |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | if (this.cacheTime) { |
| 355 | this.scheduleGc() |
| 356 | } else { |
| 357 | this.cache.remove(this) |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | this.cache.notify({ type: 'observerRemoved', query: this, observer }) |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | getObserversCount(): number { |
| 366 | return this.observers.length |
no test coverage detected