The IObserver
interface represents an observer that continues to respond to new facts after a Watch
or Subscribe
operation is initiated. It allows for controlling the observation of facts in a Jinaga system.
Task<bool> Cached { get; }
Await this task to pause until the results are loaded from local storage. Indicates whether the results were present.
true
if the results were retrieved from the local cache, otherwise false
.This property is useful to determine if the facts being observed were already stored locally or if they were fetched from a remote source.
Task Loaded { get; }
A task that resolves when the results have been loaded from the remote replicator.
Task
that is completed when the results have been fully loaded from the remote server.This property is useful to track when remote data is available for the observer, ensuring that the observation is updated with the latest data from the replicator.
Task Refresh(CancellationToken? cancellationToken = null)
Checks the replicator for new facts and updates the observer with any changes.
cancellationToken
: (Optional) A CancellationToken
to cancel the operation if needed.Task
that is completed once the observer has been updated with new facts from the replicator.This method is used to force the observer to check the remote replicator for new facts and refresh its data accordingly.
void Stop()
Stops updating the results and removes the observer.
Call this method when unloading a view model or when the observer is no longer needed. It stops the observer from receiving further updates and frees up resources.