balena-supervisor/src/event-bus.ts
Felipe Lalanne 6217546894 Update typescript to v5
This also updates code to use the default import syntax instead of
`import * as` when the imported module exposes a default. This is needed
with the latest typescript version.

Change-type: patch
2024-03-05 15:33:56 -03:00

16 lines
437 B
TypeScript

import { EventEmitter } from 'events';
import _ from 'lodash';
import type StrictEventEmitter from 'strict-event-emitter-types';
import type { TargetState } from './types/state';
export interface GlobalEvents {
deviceProvisioned: void;
targetStateChanged: TargetState;
}
type GlobalEventEmitter = StrictEventEmitter<EventEmitter, GlobalEvents>;
export const getInstance = _.once(
() => new EventEmitter() as GlobalEventEmitter,
);