diff --git a/src/cache.ts b/src/cache.ts index 802506e..ac4c3c8 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -1,6 +1,6 @@ import Storage from './storage'; -const storage = new Storage({ storageBackend: window.localStorage }); +const storage = window !== undefined ? new Storage({ storageBackend: window.localStorage }) : undefined; // https://github.com/sunnylqm/react-native-storage export async function getCacheTokens(cookieName: string): Promise> { @@ -8,17 +8,19 @@ export async function getCacheTokens(cookieName: string): Promise db('MYTABLE').return().where(e.gt('rating', ratingState)).limit(10), [ratingState]) * * const onButtonClick = (_key) => { @@ -300,7 +302,9 @@ export interface ContextValue { * * // Stays fresh after call to `.delete()` * return (
{ frame.map(ele => ) }
) + * * ``` + * * @param {function():SQW} dbInstance Function returning an instance of `db().return` without having called `.all` or `.one` * @param {React.DependencyList} deps If present, instance will be reloaded if the values in the list change. * @return {UseReturnValue} Object with the required values to statefully access an array that is subscribed to local executions to the corresponding db instance.