Skip to content

Commit

Permalink
feat: add support for using keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
polRk committed Aug 14, 2024
1 parent aa5799d commit 5d3ecb0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/discovery/discovery-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,8 @@ export default class DiscoveryService extends AuthenticatedService<DiscoveryServ
}
return endpoint;
}

[Symbol.dispose]() {
return this.destroy();
}
}
7 changes: 3 additions & 4 deletions src/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ export default class Driver {
this.logger.debug('Driver has been destroyed.');
}

// TODO: Upgrade project to TS 5.2+
// async [Symbol.asyncDispose]() {
// return this.destroy();
// }
async [Symbol.asyncDispose]() {
return this.destroy();
}
}
4 changes: 4 additions & 0 deletions src/schema/scheme-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,8 @@ export default class SchemeClient extends EventEmitter {
public async destroy() {
return;
}

[Symbol.dispose]() {
return this.destroy();
}
}
4 changes: 4 additions & 0 deletions src/table/table-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ export class TableClient extends EventEmitter {
public async destroy(ctx: Context): Promise<void> {
await this.pool.destroy(ctx);
}

async [Symbol.asyncDispose]() {
return this.destroy();
}
}
1 change: 1 addition & 0 deletions tsconfig-cjs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig-base.json",
"compilerOptions": {
"lib": ["ES2022","ESNext.Disposable"],
"target": "es2017",
"module": "commonjs",
"outDir": "build/cjs"
Expand Down
1 change: 1 addition & 0 deletions tsconfig-esm.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig-base.json",
"compilerOptions": {
"lib": ["ES2022","ESNext.Disposable"],
"module": "commonjs",
"outDir": "build/esm",
"target": "esnext"
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig-base.json",
"compilerOptions": {
"lib": ["ES2022","ESNext.Disposable"],
"target": "es2017",
"module": "commonjs",
"outDir": "build/cjs"
Expand Down

0 comments on commit 5d3ecb0

Please sign in to comment.