Files
recap/node_modules/@start9labs/start-sdk/package/lib/util/GetServiceManifest.d.ts
T

37 lines
1.7 KiB
TypeScript

import { Effects } from '../../../base/lib/Effects';
import { Manifest, PackageId } from '../../../base/lib/osBindings';
export declare class GetServiceManifest<Mapped = Manifest> {
readonly effects: Effects;
readonly packageId: PackageId;
readonly map: (manifest: Manifest | null) => Mapped;
readonly eq: (a: Mapped, b: Mapped) => boolean;
constructor(effects: Effects, packageId: PackageId, map: (manifest: Manifest | null) => Mapped, eq: (a: Mapped, b: Mapped) => boolean);
/**
* Returns the manifest of a service. Reruns the context from which it has been called if the underlying value changes
*/
const(): Promise<Mapped>;
/**
* Returns the manifest of a service. Does nothing if it changes
*/
once(): Promise<Mapped>;
private watchGen;
/**
* Watches the manifest of a service. Returns an async iterator that yields whenever the value changes
*/
watch(abort?: AbortSignal): AsyncGenerator<Mapped, never, unknown>;
/**
* Watches the manifest of a service. Takes a custom callback function to run whenever it changes
*/
onChange(callback: (value: Mapped | null, error?: Error) => {
cancel: boolean;
} | Promise<{
cancel: boolean;
}>): void;
/**
* Watches the manifest of a service. Returns when the predicate is true
*/
waitFor(pred: (value: Mapped) => boolean): Promise<Mapped>;
}
export declare function getServiceManifest(effects: Effects, packageId: PackageId): GetServiceManifest<Manifest>;
export declare function getServiceManifest<Mapped>(effects: Effects, packageId: PackageId, map: (manifest: Manifest | null) => Mapped, eq?: (a: Mapped, b: Mapped) => boolean): GetServiceManifest<Mapped>;