You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering why the ICacheOptions.backend is any type. The comment says:
// backend is expected to have the same static interface as AsyncStorage
Why not use an interface that matches AsyncStorage? Of course, this does require tracking changes in AsyncStorage, but maybe that's happening already?
exportinterfaceIBackend{/** * Fetches key and passes the result to callback, along with an Error if there is any. */getItem(key: string,callback?: (error?: Error,result?: string)=>void): Promise<string|null>;/** * Sets value for key and calls callback on completion, along with an Error if there is any */setItem(key: string,value: string,callback?: (error?: Error)=>void): Promise<void>;removeItem(key: string,callback?: (error?: Error)=>void): Promise<void>;/** * Merges existing value with input value, assuming they are stringified json. Returns a Promise object. * Not supported by all native implementation */mergeItem(key: string,value: string,callback?: (error?: Error)=>void): Promise<void>;/** * Erases all AsyncStorage for all clients, libraries, etc. You probably don't want to call this. * Use removeItem or multiRemove to clear only your own keys instead. */clear(callback?: (error?: Error)=>void): Promise<void>;/** * Gets all keys known to the app, for all callers, libraries, etc */getAllKeys(callback?: (error?: Error,keys?: string[])=>void): Promise<string[]>;/** * multiGet invokes callback with an array of key-value pair arrays that matches the input format of multiSet */multiGet(keys: string[],callback?: (errors?: Error[],result?: [string,string|null][])=>void): Promise<[string,string|null][]>;/** * multiSet and multiMerge take arrays of key-value array pairs that match the output of multiGet, * * multiSet([['k1', 'val1'], ['k2', 'val2']], cb); */multiSet(keyValuePairs: string[][],callback?: (errors?: Error[])=>void): Promise<void>;/** * Delete all the keys in the keys array. */multiRemove(keys: string[],callback?: (errors?: Error[])=>void): Promise<void>;/** * Merges existing values with input values, assuming they are stringified json. * Returns a Promise object. * * Not supported by all native implementations. */multiMerge(keyValuePairs: string[][],callback?: (errors?: Error[])=>void): Promise<void>;}exportinterfaceICacheOptions{backend: IBackend;namespace: string;policy: ICachePolicy;}
The text was updated successfully, but these errors were encountered:
I'm wondering why the
ICacheOptions.backend
isany
type. The comment says:Why not use an interface that matches AsyncStorage? Of course, this does require tracking changes in AsyncStorage, but maybe that's happening already?
The text was updated successfully, but these errors were encountered: