mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for RWLock v5.0.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;
|
||||
@@ -0,0 +1,7 @@
|
||||
// Original test file https://github.com/71104/rwlock/blob/master/test/all.js
|
||||
import * as ReadWriteLock from 'rwlock';
|
||||
|
||||
const lock = new ReadWriteLock();
|
||||
lock.readLock((release) => {
|
||||
release();
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"rwlock-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user