From 7b3082fb2f7532ce2c754e24dcfa06ce7a633098 Mon Sep 17 00:00:00 2001 From: dilan-dio4 <54545871+dilan-dio4@users.noreply.github.com> Date: Mon, 15 Nov 2021 12:21:12 -0500 Subject: [PATCH] Fixes #7 --- src/cache.ts | 66 ++++++++++++++++++++++++--------------------- src/types/types.tsx | 6 ++++- 2 files changed, 41 insertions(+), 31 deletions(-) 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.