added definitions for lockfile

This commit is contained in:
Bart van der Schoor
2014-04-28 23:42:21 +02:00
parent d8b512ed51
commit ac79fdd11b
2 changed files with 55 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
/// <reference path="lockfile.d.ts" />
import lockfile = require('lockfile');
var bool: boolean;
var num: number;
var path: string;
var opts: lockfile.Options;
var callback: (err: Error) => {
};
opts = {
wait: num,
stale: num,
retries: num,
retryWait: num
};
lockfile.lock(path, opts, callback);
lockfile.lock(path, callback);
lockfile.lockSync(path, opts);
lockfile.unlock(path, callback);;
lockfile.unlockSync(path);
lockfile.check(path, opts, callback);
lockfile.check(path, callback);
bool = lockfile.checkSync(path, opts);
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for lockfile v0.4.2
// Project: https://github.com/isaacs/lockfile
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'lockfile' {
export interface Options {
wait?: number;
stale?: number;
retries?: number;
retryWait?: number;
}
export function lock(path: string, opts: Options, callback: (err: Error) => void): void;
export function lock(path: string, callback: (err: Error) => void): void;
export function lockSync(path: string, opts: Options):void;
export function unlock(path: string, callback: (err: Error) => void): void;
export function unlockSync(path: string):void;
export function check(path: string, opts: Options, callback: (err: Error) => void): void;
export function check(path: string, callback: (err: Error) => void): void;
export function checkSync(path: string, opts: Options): boolean;
}