UNPKG

react-native-cloud-store

Version:
32 lines (31 loc) 1.97 kB
/** * From [official doc](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestore/1415989-synchronize): This method will call [synchronize()](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestore/1415989-synchronize) to explicitly synchronizes in-memory keys and values with those stored on disk. The only recommended time to call this method is upon app launch, or upon returning to the foreground, to ensure that the in-memory key-value store representation is up-to-date. */ export declare function kvSync(): Promise<void>; export declare function kvSetItem(key: string, value: string): Promise<void>; export declare function kvGetItem(key: string): Promise<string | undefined>; export declare function kvRemoveItem(key: string): Promise<void>; export declare function kvGetAllItems(): Promise<Record<string, string>>; /** * Change reasons, see [official doc](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestore/1433687-change_reason_values) for details */ export declare enum KVStoreChangedReason { NSUbiquitousKeyValueStoreServerChange = 0, NSUbiquitousKeyValueStoreInitialSyncChange = 1, NSUbiquitousKeyValueStoreQuotaViolationChange = 2, NSUbiquitousKeyValueStoreAccountChange = 3 } /** * Call this function at the beginning once to make `onKVStoreRemoteChanged` work */ export declare function registerKVStoreRemoteChangedEvent(): { remove(): void; } | undefined; export interface KVStoreChangedData { reason: KVStoreChangedReason; changedKeys?: string[]; } /** * From [official doc](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestore/1412267-didchangeexternallynotification): This notification is sent only upon a change received from iCloud; it is not sent when your app sets a value. */ export declare function onKVStoreRemoteChanged(fn: (data: KVStoreChangedData) => void): import("react-native").EmitterSubscription;