mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-07 03:40:16 +00:00
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
16 lines
437 B
TypeScript
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,
|
|
);
|