mirror of
https://github.com/n8n-io/n8n.git
synced 2024-09-27 10:17:33 -07:00
24 lines
630 B
TypeScript
24 lines
630 B
TypeScript
|
/* eslint-disable import/no-cycle */
|
||
|
import { InternalHooksClass } from './InternalHooks';
|
||
|
import { Telemetry } from './telemetry';
|
||
|
|
||
|
export class InternalHooksManager {
|
||
|
private static internalHooksInstance: InternalHooksClass;
|
||
|
|
||
|
static getInstance(): InternalHooksClass {
|
||
|
if (this.internalHooksInstance) {
|
||
|
return this.internalHooksInstance;
|
||
|
}
|
||
|
|
||
|
throw new Error('InternalHooks not initialized');
|
||
|
}
|
||
|
|
||
|
static init(instanceId: string): InternalHooksClass {
|
||
|
if (!this.internalHooksInstance) {
|
||
|
this.internalHooksInstance = new InternalHooksClass(new Telemetry(instanceId));
|
||
|
}
|
||
|
|
||
|
return this.internalHooksInstance;
|
||
|
}
|
||
|
}
|