refactor(core): rename getCurrentValue to fetchCurrentValue

Also use Promise.allSettled in ContextBridge.refresh() to handle
provider errors gracefully.

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-01-18 20:23:54 +00:00
parent 3c16dd4275
commit 037589cf4f
8 changed files with 41 additions and 19 deletions

View File

@@ -16,7 +16,7 @@
* return () => navigator.geolocation.clearWatch(watchId)
* }
*
* async getCurrentValue(): Promise<Location> {
* async fetchCurrentValue(): Promise<Location> {
* const pos = await getCurrentPosition()
* return { lat: pos.coords.latitude, lng: pos.coords.longitude, accuracy: pos.coords.accuracy }
* }
@@ -30,6 +30,6 @@ export interface ContextProvider<T = unknown> {
/** Subscribe to value changes. Returns cleanup function. */
onUpdate(callback: (value: T) => void): () => void
/** Get current value on-demand (used for manual refresh). */
getCurrentValue(): Promise<T>
/** Fetch current value on-demand (used for manual refresh). */
fetchCurrentValue(): Promise<T>
}