add types for windows-mutex (#40873)

This commit is contained in:
Benjamin Pasero 2019-12-16 14:23:16 +01:00 committed by Orta
parent b6ea495cd1
commit dee38ca920
4 changed files with 44 additions and 0 deletions

12
types/windows-mutex/index.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
// Type definitions for windows-mutex 0.4
// Project: https://github.com/Microsoft/node-windows-mutex
// Definitions by: Benjamin Pasero <https://github.com/bpasero>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export class Mutex {
constructor(name: string);
isActive(): boolean;
release(): void;
}
export function isActive(name: string): boolean;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"windows-mutex-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,8 @@
import * as windowsMutex from "windows-mutex";
const name = 'mutex-name';
windowsMutex.isActive(name);
const mutex = new windowsMutex.Mutex(name);
mutex.isActive();
mutex.release();