Add database singleton
This commit is contained in:
parent
3eeef3fc9a
commit
19dcb2000e
@ -24,6 +24,7 @@ export default class Services {
|
|||||||
private notifications: any[] | null = null;
|
private notifications: any[] | null = null;
|
||||||
private subscriptions: { element: Element; event: string; eventHandler: string }[] = [];
|
private subscriptions: { element: Element; event: string; eventHandler: string }[] = [];
|
||||||
private database: any;
|
private database: any;
|
||||||
|
private db!: Database; // Database singleton
|
||||||
private relayAddresses: { [wsurl: string]: string } = {};
|
private relayAddresses: { [wsurl: string]: string } = {};
|
||||||
private membersList: Record<string, Member> = {};
|
private membersList: Record<string, Member> = {};
|
||||||
private currentBlockHeight: number = -1;
|
private currentBlockHeight: number = -1;
|
||||||
@ -58,6 +59,7 @@ export default class Services {
|
|||||||
this.notifications = this.getNotifications();
|
this.notifications = this.getNotifications();
|
||||||
this.sdkClient = await import('../../pkg/sdk_client');
|
this.sdkClient = await import('../../pkg/sdk_client');
|
||||||
this.sdkClient.setup();
|
this.sdkClient.setup();
|
||||||
|
this.db = await Database.getInstance(); // Initialiser l'instance DB
|
||||||
for (const wsurl of Object.values(BOOTSTRAPURL)) {
|
for (const wsurl of Object.values(BOOTSTRAPURL)) {
|
||||||
this.updateRelay(wsurl, '');
|
this.updateRelay(wsurl, '');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user