@tempots/dom
Version:
Fully-typed frontend framework alternative to React and Angular
56 lines (55 loc) • 2.49 kB
TypeScript
import { Renderable, TNode } from '../types/domain';
/**
* A provider mark for a signal representing the current appearance type.
* @public
*/
export declare const probeMarker: import('..').ProviderMark<(identifier: symbol) => void>;
export type ProbeResolution = 'resolved' | 'timeout';
/**
* Provides a child component with a probe, which can be used to trigger a callback when all probes with the same identifier are resolved.
* To resolve a probe, call the `done` function passed using the `UseProbe` renderable.
*
* @param identifier - The identifier for the probe.
* @param callback - The callback to be triggered when the probe is no longer needed.
* @param child - The child component to be provided with the probe.
* @returns The child component with the probe.
* @public
*/
export declare const ProvideProbe: ({ identifier, callback, child, timeout, }: {
identifier: symbol;
callback?: (resolution: ProbeResolution) => void;
child: TNode;
timeout?: number;
}) => Renderable;
/**
* Uses a probe, which can be used to trigger a callback when all probes with the same identifier are resolved.
* To resolve a probe, call the `done` function.
*
* @param identifier - The identifier for the probe.
* @param fn - The callback to be triggered when the probe is no longer needed.
* @returns The child component with the probe.
* @public
*/
export declare const UseProbe: (identifier: symbol, fn: (done: () => void) => TNode) => Renderable;
/**
* Provides a global probe, which can be used to trigger a callback when all probes with the same identifier are resolved.
* To resolve a probe, call the `done` function passed using the `UseProbe` renderable.
*
* @param callback - The callback to be triggered when the probe is no longer needed.
* @param child - The child component to be provided with the probe.
* @returns The child component with the probe.
* @public
*/
export declare const ProvideGlobalProbe: ({ callback, timeout, }: {
callback?: (resolution: ProbeResolution) => void;
timeout?: number;
}, child: TNode) => Renderable;
/**
* Uses a global probe, which can be used to trigger a callback when all probes with the same identifier are resolved.
* To resolve a probe, call the `done` function.
*
* @param fn - The callback to be triggered when the probe is no longer needed.
* @returns The child component with the probe.
* @public
*/
export declare const UseGlobalProbe: (fn: (done: () => void) => TNode) => Renderable;