* Requests the sync layer to load more data. * @param options Options to control what data is being loaded * @returns If data loading is asynchronous, this method returns a promise that resolves when the data is loaded. * Returns true if no sync function is configured, if syncMode
(options: LoadSubsetOptions)
| 481 | * Returns true if no sync function is configured, if syncMode is 'eager', or if there is no work to do. |
| 482 | */ |
| 483 | public loadSubset(options: LoadSubsetOptions): Promise<void> | true { |
| 484 | // Bypass loadSubset when syncMode is 'eager' |
| 485 | if (this.syncMode === `eager`) { |
| 486 | return true |
| 487 | } |
| 488 | |
| 489 | if (this.syncLoadSubsetFn) { |
| 490 | const result = this.syncLoadSubsetFn(options) |
| 491 | // If the result is a promise, track it |
| 492 | if (result instanceof Promise) { |
| 493 | this.trackLoadPromise(result) |
| 494 | return result |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | return true |
| 499 | } |
| 500 | |
| 501 | /** |
| 502 | * Notifies the sync layer that a subset is no longer needed. |