Files
DefinitelyTyped/types/rwlock/index.d.ts
Federico Caselli 8477fccea4 timeoutCallback is optional (#16197)
Add an optional extended description…
2017-04-28 14:07:55 -07:00

31 lines
1000 B
TypeScript

// Type definitions for RWLock 5.0
// Project: https://github.com/71104/rwlock
// Definitions by: Federico Caselli <https://github.com/CaselIT/typings-rwlock>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class ReadWriteGeneric<T> {
readLock(callback: T, options?: ReadWriteLock.Options): void;
readLock(key: string, callback: T, options?: ReadWriteLock.Options): void;
writeLock(callback: T, options?: ReadWriteLock.Options): void;
writeLock(key: string, callback: T, options?: ReadWriteLock.Options): void;
}
declare namespace ReadWriteLock {
type Release = () => void;
type Callback = (release: Release) => void;
type AsyncCallback = (err: Error, release: Release) => void;
interface Options {
scope?: any;
timeout?: number;
timeoutCallback?(): void;
}
}
declare class ReadWriteLock extends ReadWriteGeneric<ReadWriteLock.Callback> {
constructor();
async: ReadWriteGeneric<ReadWriteLock.AsyncCallback>;
}
export = ReadWriteLock;