mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
added definitions for lockfile
This commit is contained in:
@@ -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);
|
||||
Vendored
+24
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user