[@types/generic-pool] Add pool.isBorrowedResource

This commit is contained in:
Aries-wang
2018-10-29 11:51:32 +08:00
parent 3d82362c03
commit 912e61faeb
2 changed files with 2 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ pool.use((conn: Connection) => 'test')
pool.acquire()
.then((conn: Connection) => {
console.log(pool.isBorrowedResource(conn)); // => true
return pool.release(conn);
}).then(() => {
return pool.acquire(5);

View File

@@ -24,6 +24,7 @@ export class Pool<T> extends EventEmitter {
drain(): PromiseLike<void>;
clear(): PromiseLike<void>;
use<U>(cb: (resource: T) => U): PromiseLike<U>;
isBorrowedResource(resource: T): boolean;
}
export interface Factory<T> {