@plasmicapp/query
Advanced tools
Comparing version 0.1.75 to 0.1.76
@@ -1,3 +0,75 @@ | ||
export { useSWRConfig } from "swr"; | ||
export { addLoadingStateListener, isPlasmicPrepass, PlasmicPrepassContext, PlasmicQueryDataProvider, useMutablePlasmicQueryData, usePlasmicDataConfig, usePlasmicQueryData, wrapLoadingFetcher, } from "./query-data"; | ||
export type { LoadingStateListener, SWRResponse } from "./query-data"; | ||
import { Fetcher } from 'swr'; | ||
import { Key } from 'swr'; | ||
import { PropsWithChildren } from 'react'; | ||
import { default as React_2 } from 'react'; | ||
import { SWRConfiguration } from 'swr'; | ||
import { SWRResponse } from 'swr'; | ||
import { useSWRConfig } from 'swr'; | ||
/** | ||
* Subscribes to whether any loading is happening via @plasmicapp/query. | ||
* Returns a function to unsubscribe. | ||
*/ | ||
export declare function addLoadingStateListener(listener: LoadingStateListener, opts?: { | ||
immediate?: boolean; | ||
}): () => void; | ||
export declare function isPlasmicPrepass(): boolean; | ||
export declare type LoadingStateListener = (isLoading: boolean) => void; | ||
export declare function PlasmicPrepassContext(props: PropsWithChildren<{ | ||
cache: Map<string, any>; | ||
}>): React_2.JSX.Element; | ||
export declare function PlasmicQueryDataProvider(props: { | ||
suspense?: boolean; | ||
children: React_2.ReactNode; | ||
prefetchedCache?: Record<string, any>; | ||
}): React_2.JSX.Element; | ||
export { SWRResponse } | ||
/** | ||
* Fetches data asynchronously using SWR Hook (https://swr.vercel.app/) | ||
* | ||
* @param key a unique key for this data fetch; if data already exists under this | ||
* key, that data is returned immediately. | ||
* @param fetcher an async function that resolves to the fetched data. | ||
* @param options (optional) an object of options for this hook (https://swr.vercel.app/docs/options). | ||
* @returns an object with either a "data" key with the fetched data if the fetch | ||
* was successful, or an "error" key with the thrown Error if the fetch failed. | ||
*/ | ||
export declare function useMutablePlasmicQueryData<T, E>(key: Key, fetcher: Fetcher<T>, options?: SWRConfiguration<T, E>): SWRResponse<T, E> & { | ||
isLoading?: boolean; | ||
isLagging?: boolean; | ||
}; | ||
export declare const usePlasmicDataConfig: typeof useSWRConfig; | ||
/** | ||
* Fetches data asynchronously. This data should be considered immutable for the | ||
* session -- there is no way to invalidate or re-fetch this data. | ||
* | ||
* @param key a unique key for this data fetch; if data already exists under this | ||
* key, that data is returned immediately. | ||
* @param fetcher an async function that resolves to the fetched data. | ||
* @returns an object with either a "data" key with the fetched data if the fetch | ||
* was successful, or an "error" key with the thrown Error if the fetch failed. | ||
*/ | ||
export declare function usePlasmicQueryData<T>(key: Key, fetcher: Fetcher<T>): { | ||
data?: T; | ||
error?: Error; | ||
isLoading?: boolean; | ||
}; | ||
export { useSWRConfig } | ||
/** | ||
* Instruments an async function to increment and decrement the number of | ||
* simultaneous async loads. You can then subscribe to whether there | ||
* are any loads happening via addLoadingStateListener(). | ||
*/ | ||
export declare function wrapLoadingFetcher<T extends (...args: any[]) => Promise<any> | any>(fetcher: T): T; | ||
export { } |
{ | ||
"version": "0.1.75", | ||
"version": "0.1.76", | ||
"license": "MIT", | ||
@@ -50,3 +50,3 @@ "types": "./dist/index.d.ts", | ||
}, | ||
"gitHead": "1089fbd93d2ac0d2ac7e0e8f755ba98d5c21f0eb" | ||
"gitHead": "48a2877c3dc093d101508fcdde2fd213055fdab9" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
775
53311
9