|
9 | 9 |
|
10 | 10 | import EventEmitter from 'eventemitter3' |
11 | 11 | import { SQLiteCloudConnection } from './connection' |
12 | | -import { PubSub } from './pubsub' |
13 | 12 | import { OperationsQueue } from './queue' |
14 | 13 | import { SQLiteCloudRowset } from './rowset' |
15 | 14 | import { Statement } from './statement' |
@@ -386,7 +385,7 @@ export class Database extends EventEmitter { |
386 | 385 | public close(callback?: ConnectionCallback): void { |
387 | 386 | this.operations.enqueue(done => { |
388 | 387 | this.connection?.close() |
389 | | - |
| 388 | + |
390 | 389 | callback?.call(this, null) |
391 | 390 | this.emitEvent('close') |
392 | 391 |
|
@@ -477,30 +476,4 @@ export class Database extends EventEmitter { |
477 | 476 | public isConnected(): boolean { |
478 | 477 | return this.connection != null && this.connection.connected |
479 | 478 | } |
480 | | - |
481 | | - /** |
482 | | - * PubSub class provides a Pub/Sub real-time updates and notifications system to |
483 | | - * allow multiple applications to communicate with each other asynchronously. |
484 | | - * It allows applications to subscribe to tables and receive notifications whenever |
485 | | - * data changes in the database table. It also enables sending messages to anyone |
486 | | - * subscribed to a specific channel. |
487 | | - * @returns {PubSub} A PubSub object |
488 | | - */ |
489 | | - public async getPubSub(): Promise<PubSub> { |
490 | | - return new Promise((resolve, reject) => { |
491 | | - this.operations.enqueue(done => { |
492 | | - let error = null |
493 | | - try { |
494 | | - if (!this.connection) { |
495 | | - error = new SQLiteCloudError('Connection not established', { errorCode: 'ERR_CONNECTION_NOT_ESTABLISHED' }) |
496 | | - reject(error) |
497 | | - } else { |
498 | | - resolve(new PubSub(this.connection)) |
499 | | - } |
500 | | - } finally { |
501 | | - done(error) |
502 | | - } |
503 | | - }) |
504 | | - }) |
505 | | - } |
506 | 479 | } |
0 commit comments