diff --git a/lib/resource/lock/Lock.d.ts b/lib/resource/lock/Lock.d.ts index a01c1394..9ea2a151 100644 --- a/lib/resource/lock/Lock.d.ts +++ b/lib/resource/lock/Lock.d.ts @@ -11,4 +11,5 @@ export declare class Lock { user: IUser; constructor(lockKind: LockKind, user: IUser, owner: LockOwner); expired(): boolean; + refresh(timeout?: number): void; } diff --git a/lib/resource/lock/Lock.js b/lib/resource/lock/Lock.js index 4a2f47c7..5ff5cdb7 100644 --- a/lib/resource/lock/Lock.js +++ b/lib/resource/lock/Lock.js @@ -29,6 +29,9 @@ var Lock = (function () { Lock.prototype.expired = function () { return Date.now() > this.expirationDate; }; + Lock.prototype.refresh = function (timeout) { + this.expirationDate += timeout ? timeout : this.lockKind.timeout; + }; return Lock; }()); exports.Lock = Lock; diff --git a/src/resource/lock/Lock.ts b/src/resource/lock/Lock.ts index 2d8cea40..22305275 100644 --- a/src/resource/lock/Lock.ts +++ b/src/resource/lock/Lock.ts @@ -55,4 +55,9 @@ export class Lock { return Date.now() > this.expirationDate; } + + refresh(timeout ?: number) + { + this.expirationDate += timeout ? timeout : this.lockKind.timeout; + } }