UNPKG

thorish

Version:

This is a library of useful JS concepts and data structures for Node and the browser. It it, unashamedly, a dumping ground for code needed by [@samthor](https://twitter.com/samthor)'s projects.

22 lines (21 loc) 872 B
/** * Wait for a later {@link objectNotify} or {@link objectNotifyAll} call on this {@link Object}. * * This will resolve with `true` if notified. * * The returned {@link Promise} here represents a token that is triggered with {@link objectNotify}. * You should abort the passed signal if you are no longer interested, in which case it will be resolved with `false` (rather than rejecting). */ export declare function objectWait(host: Object, signal?: AbortSignal): Promise<boolean>; /** * Notifies a waiter on this {@link Object} in a microtask. * * Returns `true` if one was woken up, `false` otherwise. */ export declare function objectNotify(host: Object): boolean; /** * Notifies all waiters for this {@link Object} in independent microtasks. * * Returns the count of waiters woken up. */ export declare function objectNotifyAll(host: Object): number;