AAE-30878 Migrating from event-emitter to eventemitter3 (#11187)

* AAE-30878 Migrating from event-emitter to eventemitter3 which is … (#11116)

* [AAE-30878] - have a single place for the EventEmitter types
This commit is contained in:
Vito Albano
2025-09-16 09:33:06 +01:00
committed by GitHub
parent 10afe75e94
commit b400757ad1
18 changed files with 186 additions and 269 deletions
@@ -21,6 +21,7 @@ import { HttpClientTestingModule, HttpTestingController } from '@angular/common/
import { TestBed } from '@angular/core/testing';
import { AdfHttpClient } from './adf-http-client.service';
import { AlfrescoApiResponseError } from './alfresco-api/alfresco-api.response-error';
import EventEmitter from 'eventemitter3';
const securityOptions: SecurityOptions = {
authentications: {},
@@ -30,16 +31,9 @@ const securityOptions: SecurityOptions = {
withCredentials: false
};
const emitter = {
emit: () => {},
off: () => {},
on: () => {},
once: () => {}
};
const emitters: Emitters = {
eventEmitter: emitter,
apiClientEmitter: emitter
eventEmitter: new EventEmitter(),
apiClientEmitter: new EventEmitter()
};
const mockResponse = {
@@ -124,10 +118,10 @@ describe('AdfHttpClient', () => {
httpMethod: 'POST'
};
const spy = spyOn(emitter, 'emit').and.callThrough();
const eventSpy = spyOn(emitters.eventEmitter, 'emit').and.callThrough();
angularHttpClient.request('http://example.com', options, securityOptions, emitters).catch(() => {
expect(spy).toHaveBeenCalledWith('unauthorized');
expect(eventSpy).toHaveBeenCalledWith('unauthorized');
done();
});
+44 -31
View File
@@ -16,7 +16,7 @@
*/
import { SHOULD_ADD_AUTH_TOKEN } from '@alfresco/adf-core/auth';
import { Emitters as JsApiEmitters, HttpClient as JsApiHttpClient } from '@alfresco/js-api';
import { Emitters as JsApiEmitters, HttpClient as JsApiHttpClient, EventEmitterInstance, EventEmitterEvents } from '@alfresco/js-api';
import { HttpClient, HttpContext, HttpErrorResponse, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { lastValueFrom, Observable, of, Subject, throwError } from 'rxjs';
@@ -34,23 +34,20 @@ import { AlfrescoApiParamEncoder } from './alfresco-api/alfresco-api.param-encod
import { AlfrescoApiResponseError } from './alfresco-api/alfresco-api.response-error';
import { Constructor } from './types';
import { RequestOptions, SecurityOptions } from './interfaces';
import ee, { Emitter } from 'event-emitter';
import { EventEmitter } from 'eventemitter3';
export interface Emitters {
readonly eventEmitter: Emitter;
readonly apiClientEmitter: Emitter;
readonly eventEmitter: EventEmitterInstance;
readonly apiClientEmitter: EventEmitterInstance;
}
@Injectable({
providedIn: 'root'
})
export class AdfHttpClient implements ee.Emitter, JsApiHttpClient {
on: ee.EmitterMethod;
off: ee.EmitterMethod;
once: ee.EmitterMethod;
_disableCsrf: boolean;
export class AdfHttpClient implements JsApiHttpClient {
private eventEmitter = new EventEmitter();
emit: (type: string, ...args: any[]) => void;
_disableCsrf: boolean;
get disableCsrf(): boolean {
return this._disableCsrf;
@@ -68,7 +65,27 @@ export class AdfHttpClient implements ee.Emitter, JsApiHttpClient {
};
constructor(private httpClient: HttpClient) {
ee(this);
// No need for ee(this) anymore - we use composition instead of inheritance
}
// EventEmitter delegation methods
on(event: EventEmitterEvents, fn: (...args: any[]) => void, context?: any): this {
this.eventEmitter.on(event, fn, context);
return this;
}
off(event: EventEmitterEvents, fn?: (...args: any[]) => void, context?: any): this {
this.eventEmitter.off(event, fn, context);
return this;
}
once(event: EventEmitterEvents, fn: (...args: any[]) => void, context?: any): this {
this.eventEmitter.once(event, fn, context);
return this;
}
emit(event: EventEmitterEvents, ...args: any[]): boolean {
return this.eventEmitter.emit(event, ...args);
}
setDefaultSecurityOption(options: any) {
@@ -136,24 +153,19 @@ export class AdfHttpClient implements ee.Emitter, JsApiHttpClient {
private addPromiseListeners<T = any>(promise: Promise<T>, eventEmitter: any) {
const eventPromise = Object.assign(promise, {
on() {
// eslint-disable-next-line prefer-spread, prefer-rest-params
eventEmitter.on.apply(eventEmitter, arguments);
on<K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any) {
eventEmitter.on(event, fn, context);
return this;
},
once() {
// eslint-disable-next-line prefer-spread, prefer-rest-params
eventEmitter.once.apply(eventEmitter, arguments);
once<K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any) {
eventEmitter.once(event, fn, context);
return this;
},
emit() {
// eslint-disable-next-line prefer-spread, prefer-rest-params
eventEmitter.emit.apply(eventEmitter, arguments);
return this;
emit<K extends string | symbol>(event: K, ...args: any[]): boolean {
return eventEmitter.emit(event, ...args);
},
off() {
// eslint-disable-next-line prefer-spread, prefer-rest-params
eventEmitter.off.apply(eventEmitter, arguments);
off<K extends string | symbol>(event: K, fn?: (...args: any[]) => void, context?: any) {
eventEmitter.off(event, fn, context);
return this;
}
});
@@ -162,16 +174,17 @@ export class AdfHttpClient implements ee.Emitter, JsApiHttpClient {
}
private getEventEmitters(): Emitters {
const apiClientEmitter = {
on: this.on.bind(this),
off: this.off.bind(this),
once: this.once.bind(this),
emit: this.emit.bind(this)
};
const apiClientEmitter: EventEmitterInstance = new EventEmitter();
// Bind this instance's methods to the apiClientEmitter for backward compatibility
apiClientEmitter.on = this.on.bind(this);
apiClientEmitter.off = this.off.bind(this);
apiClientEmitter.once = this.once.bind(this);
apiClientEmitter.emit = this.emit.bind(this);
return {
apiClientEmitter,
eventEmitter: ee({})
eventEmitter: new EventEmitter()
};
}
@@ -16,18 +16,20 @@
*/
import { HttpHeaders } from '@angular/common/http';
import ee from 'event-emitter';
import { EventEmitter } from 'eventemitter3';
import { Observable } from 'rxjs';
type EventEmitterInstance = InstanceType<typeof EventEmitter>;
export interface AuthenticationServiceInterface {
onError: any;
onLogin: any;
onLogout: any;
on: ee.EmitterMethod;
off: ee.EmitterMethod;
once: ee.EmitterMethod;
emit: (type: string, ...args: any[]) => void;
on: EventEmitterInstance['on'];
off: EventEmitterInstance['off'];
once: EventEmitterInstance['once'];
emit: EventEmitterInstance['emit'];
getToken(): string;
isLoggedIn(): boolean;
@@ -21,13 +21,13 @@ import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.serv
import { Observable, Subject, from } from 'rxjs';
import { HttpHeaders } from '@angular/common/http';
import { AuthenticationServiceInterface } from '../interfaces/authentication-service.interface';
import ee from 'event-emitter';
import { RedirectAuthService } from '../oidc/redirect-auth.service';
import { EventEmitter } from 'eventemitter3';
type EventEmitterInstance = InstanceType<typeof EventEmitter>;
@Injectable({
providedIn: 'root'
})
export class AuthenticationService implements AuthenticationServiceInterface, ee.Emitter {
export class AuthenticationService implements AuthenticationServiceInterface {
onLogin: Subject<any> = new Subject<any>();
onLogout: Subject<any> = new Subject<any>();
onTokenReceived: Subject<any> = new Subject<any>();
@@ -49,19 +49,19 @@ export class AuthenticationService implements AuthenticationServiceInterface, ee
}
}
get on(): ee.EmitterMethod {
get on(): EventEmitterInstance['on'] {
return this.isOauth() ? this.oidcAuthenticationService.on : this.basicAlfrescoAuthService.on;
}
get off(): ee.EmitterMethod {
get off(): EventEmitterInstance['off'] {
return this.isOauth() ? this.oidcAuthenticationService.off : this.basicAlfrescoAuthService.off;
}
get once(): ee.EmitterMethod {
get once(): EventEmitterInstance['once'] {
return this.isOauth() ? this.oidcAuthenticationService.once : this.basicAlfrescoAuthService.once;
}
get emit(): (type: string, ...args: any[]) => void {
get emit(): EventEmitterInstance['emit'] {
return this.isOauth() ? this.oidcAuthenticationService.emit : this.basicAlfrescoAuthService.emit;
}
@@ -21,13 +21,12 @@ import { Observable, Observer, ReplaySubject, throwError } from 'rxjs';
import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service';
import { CookieService } from '../../common/services/cookie.service';
import { AuthenticationServiceInterface } from '../interfaces/authentication-service.interface';
import ee from 'event-emitter';
export abstract class BaseAuthenticationService implements AuthenticationServiceInterface, ee.Emitter {
on: ee.EmitterMethod;
off: ee.EmitterMethod;
once: ee.EmitterMethod;
emit: (type: string, ...args: any[]) => void;
import { EventEmitterInstance } from '@alfresco/js-api';
export abstract class BaseAuthenticationService implements AuthenticationServiceInterface {
on: EventEmitterInstance['on'];
off: EventEmitterInstance['off'];
once: EventEmitterInstance['once'];
emit: EventEmitterInstance['emit'];
protected redirectUrl: RedirectionModel = null;
@@ -38,9 +37,7 @@ export abstract class BaseAuthenticationService implements AuthenticationService
protected constructor(
protected appConfig: AppConfigService,
protected cookie: CookieService
) {
ee(this);
}
) {}
abstract getAuthHeaders(requestUrl: string, header: HttpHeaders): HttpHeaders;
abstract getToken(): string;
+1
View File
@@ -43,3 +43,4 @@ export * from './src/api-clients/api-client';
export * from './src/api-clients/http-client.interface';
export * from './src/utils';
export * from './src/constants';
export * from './src/types';
+1 -1
View File
@@ -15,7 +15,7 @@
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"dependencies": {
"event-emitter": "^0.3.5",
"eventemitter3": "^5.0.1",
"superagent": "^9.0.1",
"tslib": "^2.6.1"
},
+20 -30
View File
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import ee, { EmitterMethod, Emitter } from 'event-emitter';
import { EventEmitter } from 'eventemitter3';
import { ContentAuth } from './authentication/contentAuth';
import { ProcessAuth } from './authentication/processAuth';
import { Oauth2Auth } from './authentication/oauth2Auth';
@@ -26,11 +26,11 @@ import { AlfrescoApiConfig } from './alfrescoApiConfig';
import { Authentication } from './authentication/authentication';
import { AlfrescoApiType } from './to-deprecate/alfresco-api-type';
import { HttpClient } from './api-clients/http-client.interface';
import { AlfrescoApiClient, AlfrescoApiClientPromise } from './alfrescoApiClient';
import { EventEmitterInstance } from './types';
export class AlfrescoApi implements Emitter, AlfrescoApiType {
export class AlfrescoApi extends AlfrescoApiClient implements AlfrescoApiType {
__type = 'legacy-client';
storage: Storage;
config: AlfrescoApiConfig;
contentClient: ContentClient;
contentPrivateClient: ContentClient;
processClient: ProcessClient;
@@ -43,21 +43,11 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
processAuth: ProcessAuth;
contentAuth: ContentAuth;
on: EmitterMethod;
off: EmitterMethod;
once: EmitterMethod;
bufferEvents: string[] = [];
emit: (type: string, ...args: any[]) => void;
username: string;
constructor(
config?: AlfrescoApiConfig,
public httpClient?: HttpClient
) {
ee(this);
constructor(config?: AlfrescoApiConfig, httpClient?: HttpClient) {
super(undefined, httpClient);
if (config) {
this.setConfig(config);
@@ -395,14 +385,15 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
return this.contentAuth.validateTicket();
}
private loginBPMECM(username: string, password: string): Promise<[string, string]> {
private loginBPMECM(username: string, password: string): AlfrescoApiClientPromise<[string, string]> {
const contentPromise = this.contentAuth.login(username, password);
const processPromise = this.processAuth.login(username, password);
const promise: any = new Promise<[string, string]>((resolve, reject) => {
const eventEmitter: EventEmitterInstance = new EventEmitter();
const promise = new Promise<[string, string]>((resolve, reject) => {
Promise.all([contentPromise, processPromise]).then(
(data) => {
promise.emit('success');
eventEmitter.emit('success');
resolve(data);
},
(error) => {
@@ -410,16 +401,15 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
this.processAuth.invalidateSession();
if (error.status === 401) {
promise.emit('unauthorized');
eventEmitter.emit('unauthorized');
}
promise.emit('error');
eventEmitter.emit('error');
reject(error);
}
);
});
ee(promise); // jshint ignore:line
return promise;
return this.addPromiseListeners(promise, eventEmitter);
}
/**
@@ -452,29 +442,29 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
return Promise.resolve();
}
private _logoutBPMECM(): Promise<void> {
private _logoutBPMECM(): AlfrescoApiClientPromise<void> {
const contentPromise = this.contentAuth.logout();
const processPromise = this.processAuth.logout();
const promise: any = new Promise<void>((resolve, reject) => {
const eventEmitter: EventEmitterInstance = new EventEmitter();
const promise = new Promise<void>((resolve, reject) => {
Promise.all([contentPromise, processPromise]).then(
() => {
this.config.ticket = undefined;
promise.emit('logout');
eventEmitter.emit('logout');
resolve();
},
(error) => {
if (error.status === 401) {
promise.emit('unauthorized');
eventEmitter.emit('unauthorized');
}
promise.emit('error');
eventEmitter.emit('error');
reject(error);
}
);
});
ee(promise); // jshint ignore:line
return promise;
return this.addPromiseListeners(promise, eventEmitter);
}
/**
+40 -31
View File
@@ -15,21 +15,22 @@
* limitations under the License.
*/
import ee from 'event-emitter';
import { EventEmitter } from 'eventemitter3';
import { AlfrescoApiConfig } from './alfrescoApiConfig';
import { Authentication } from './authentication/authentication';
import { SuperagentHttpClient } from './superagentHttpClient';
import { Emitters, HttpClient, LegacyHttpClient, RequestOptions, SecurityOptions } from './api-clients/http-client.interface';
import { paramToString } from './utils';
import { Storage } from './storage';
import { EventEmitterInstance } from './types';
declare const Buffer: any;
export type AlfrescoApiClientPromise<T = any> = Promise<T> & {
on: ee.EmitterMethod;
off: ee.EmitterMethod;
once: ee.EmitterMethod;
emit: (type: string, ...args: any[]) => void;
on: <K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any) => AlfrescoApiClientPromise<T>;
off: <K extends string | symbol>(event: K, fn?: (...args: any[]) => void, context?: any) => AlfrescoApiClientPromise<T>;
once: <K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any) => AlfrescoApiClientPromise<T>;
emit: <K extends string | symbol>(event: K, ...args: any[]) => boolean;
abort?: () => void;
};
@@ -62,11 +63,8 @@ export function buildCollectionParam(param: string[], collectionFormat: string):
}
}
export class AlfrescoApiClient implements ee.Emitter, LegacyHttpClient {
on: ee.EmitterMethod;
off: ee.EmitterMethod;
once: ee.EmitterMethod;
emit: (type: string, ...args: any[]) => void;
export class AlfrescoApiClient implements LegacyHttpClient {
private eventEmitter = new EventEmitter();
storage: Storage;
host: string;
@@ -105,13 +103,29 @@ export class AlfrescoApiClient implements ee.Emitter, LegacyHttpClient {
constructor(host?: string, httpClient?: HttpClient) {
this.host = host;
this.storage = Storage.getInstance();
// fallback for backward compatibility
this.httpClient = httpClient || new SuperagentHttpClient();
}
ee(this);
// EventEmitter delegation methods
on<K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any): this {
this.eventEmitter.on(event, fn, context);
return this;
}
off<K extends string | symbol>(event: K, fn?: (...args: any[]) => void, context?: any): this {
this.eventEmitter.off(event, fn, context);
return this;
}
once<K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any): this {
this.eventEmitter.once(event, fn, context);
return this;
}
emit<K extends string | symbol>(event: K, ...args: any[]): boolean {
return this.eventEmitter.emit(event, ...args);
}
request<T = any>(options: RequestOptions): Promise<T> {
@@ -325,7 +339,7 @@ export class AlfrescoApiClient implements ee.Emitter, LegacyHttpClient {
return {
apiClientEmitter,
eventEmitter: ee({})
eventEmitter: new EventEmitter()
};
}
@@ -374,27 +388,22 @@ export class AlfrescoApiClient implements ee.Emitter, LegacyHttpClient {
return Boolean(contentType?.match(/^application\/json(;.*)?$/i));
}
private addPromiseListeners<T = any>(promise: Promise<T>, eventEmitter: ee.Emitter): AlfrescoApiClientPromise<T> {
addPromiseListeners<T = any>(promise: Promise<T>, eventEmitter: EventEmitterInstance): AlfrescoApiClientPromise<T> {
return Object.assign(promise, {
on() {
// eslint-disable-next-line prefer-spread,prefer-rest-params
eventEmitter.on.apply(eventEmitter, arguments);
return this;
on<K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any): AlfrescoApiClientPromise<T> {
eventEmitter.on(event, fn, context);
return this as AlfrescoApiClientPromise<T>;
},
once() {
// eslint-disable-next-line prefer-spread,prefer-rest-params
eventEmitter.once.apply(eventEmitter, arguments);
return this;
once<K extends string | symbol>(event: K, fn: (...args: any[]) => void, context?: any): AlfrescoApiClientPromise<T> {
eventEmitter.once(event, fn, context);
return this as AlfrescoApiClientPromise<T>;
},
emit() {
// eslint-disable-next-line prefer-spread,prefer-rest-params
eventEmitter.emit.apply(eventEmitter, arguments);
return this;
emit<K extends string | symbol>(event: K, ...args: any[]): boolean {
return eventEmitter.emit(event, ...args);
},
off() {
// eslint-disable-next-line prefer-spread,prefer-rest-params
eventEmitter.off.apply(eventEmitter, arguments);
return this;
off<K extends string | symbol>(event: K, fn?: (...args: any[]) => void, context?: any): AlfrescoApiClientPromise<T> {
eventEmitter.off(event, fn, context);
return this as AlfrescoApiClientPromise<T>;
}
});
}
@@ -15,8 +15,8 @@
* limitations under the License.
*/
import { EventEmitterInstance } from './../types';
import { Authentication } from '../authentication/authentication';
import { Emitter } from 'event-emitter';
export interface RequestOptions {
path: string;
@@ -93,8 +93,13 @@ export interface SecurityOptions {
}
export interface Emitters {
readonly eventEmitter: Emitter;
readonly apiClientEmitter: Emitter;
readonly eventEmitter: EventEmitterInstance;
readonly apiClientEmitter: {
on: EventEmitterInstance['on'];
off: EventEmitterInstance['off'];
once: EventEmitterInstance['once'];
emit: EventEmitterInstance['emit'];
};
}
export interface HttpClient {
+4 -7
View File
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import ee from 'event-emitter';
import { EventEmitter } from 'eventemitter3';
import { AuthenticationApi, TicketBody } from '../api/auth-rest-api';
import { AlfrescoApiClient } from '../alfrescoApiClient';
import { AlfrescoApiConfig } from '../alfrescoApiConfig';
@@ -104,8 +104,7 @@ export class ContentAuth extends AlfrescoApiClient {
});
});
ee(promise); // jshint ignore:line
return promise;
return this.addPromiseListeners(promise, new EventEmitter());
}
/**
@@ -133,8 +132,7 @@ export class ContentAuth extends AlfrescoApiClient {
);
});
ee(promise); // jshint ignore:line
return promise;
return this.addPromiseListeners(promise, new EventEmitter());
}
/**
@@ -160,8 +158,7 @@ export class ContentAuth extends AlfrescoApiClient {
);
});
ee(promise); // jshint ignore:line
return promise;
return this.addPromiseListeners(promise, new EventEmitter());
}
/**
+3 -5
View File
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import ee from 'event-emitter';
import { EventEmitter } from 'eventemitter3';
import { AlfrescoApiClient } from '../alfrescoApiClient';
import { AlfrescoApiConfig } from '../alfrescoApiConfig';
import { Authentication } from './authentication';
@@ -604,7 +604,7 @@ export class Oauth2Auth extends AlfrescoApiClient {
}
);
ee(promise); // jshint ignore:line
return this.addPromiseListeners(promise, new EventEmitter());
}
pollingRefreshToken() {
@@ -654,9 +654,7 @@ export class Oauth2Auth extends AlfrescoApiClient {
);
});
ee(promise); // jshint ignore:line
return promise;
return this.addPromiseListeners(promise, new EventEmitter());
}
universalBtoa(stringToConvert: string) {
+3 -5
View File
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import ee from 'event-emitter';
import { EventEmitter } from 'eventemitter3';
import { AlfrescoApiClient, AlfrescoApiClientPromise } from '../alfrescoApiClient';
import { AlfrescoApiConfig } from '../alfrescoApiConfig';
import { Authentication } from './authentication';
@@ -123,8 +123,7 @@ export class ProcessAuth extends AlfrescoApiClient {
);
});
ee(promise); // jshint ignore:line
return promise;
return this.addPromiseListeners(promise, new EventEmitter());
}
/**
@@ -154,8 +153,7 @@ export class ProcessAuth extends AlfrescoApiClient {
);
});
ee(promise);
return promise;
return this.addPromiseListeners(promise, new EventEmitter());
}
/**
+1
View File
@@ -43,3 +43,4 @@ export * from './api-clients/api-client';
export * from './api-clients/http-client.interface';
export * from './utils';
export * from './constants';
export * from './types';
+3 -3
View File
@@ -15,13 +15,13 @@
* limitations under the License.
*/
import ee, { Emitter } from 'event-emitter';
import superagent, { Response, SuperAgentRequest } from 'superagent';
import { Authentication } from './authentication/authentication';
import { RequestOptions, HttpClient, SecurityOptions, Emitters } from './api-clients/http-client.interface';
import { Oauth2 } from './authentication/oauth2';
import { BasicAuth } from './authentication/basicAuth';
import { isBrowser, paramToString } from './utils';
import { EventEmitterInstance } from './types';
declare const Blob: any;
declare const Buffer: any;
@@ -134,7 +134,7 @@ export class SuperagentHttpClient implements HttpClient {
contentType: string,
accept: string,
responseType: string,
eventEmitter: ee.Emitter,
eventEmitter: EventEmitterInstance,
returnType: string,
securityOptions: SecurityOptions
) {
@@ -268,7 +268,7 @@ export class SuperagentHttpClient implements HttpClient {
}
}
private progress(event: ProgressEvent | unknown, eventEmitter: Emitter): void {
private progress(event: ProgressEvent | unknown, eventEmitter: EventEmitterInstance): void {
if (isProgressEvent(event)) {
const percent = Math.round((event.loaded / event.total) * 100);
+21
View File
@@ -0,0 +1,21 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { EventEmitter } from 'eventemitter3';
export type EventEmitterInstance = InstanceType<typeof EventEmitter>;
export type EventEmitterEvents = 'progress' | 'success' | 'error' | 'forbidden' | 'abort' | 'unauthorized' | string;