14 lines
310 B
TypeScript
14 lines
310 B
TypeScript
const ErrorDispatcher = {
|
|
errorHandlers: [],
|
|
|
|
registerErrorHandler(errorHandlerFn) {
|
|
this.errorHandlers.push(errorHandlerFn);
|
|
},
|
|
|
|
raiseError(errorMessage) {
|
|
for (let i = 0; i < this.errorHandlers.length; i++)
|
|
this.errorHandlers[i](errorMessage);
|
|
}
|
|
};
|
|
|
|
export default ErrorDispatcher; |