rxdb-hooks
Version:
React hooks for integrating with RxDB
16 lines (15 loc) • 721 B
TypeScript
import { RxQuery } from 'rxdb';
/**
* Second variable in array is a function that can be invoked to cancel the promise.
*/
export type CancelablePromise<T> = [Promise<T>, () => void];
/**
* Makes promise cancelable.
* Wraps original promise in an object that exposes said promise
* and also exposes a cancel() method for canceling the promise.
* Canceling the promise will prevent it from resolving/rejecting once the
* the underlying promise resolves/reject.
*/
export declare const getCancelablePromise: <T>(promise: Promise<T>) => CancelablePromise<T>;
export declare const isObject: (val: unknown) => val is Record<string, unknown>;
export declare const isRxQuery: (val: unknown) => val is RxQuery<any, any>;