1.4.0 • Published 5 years ago
all-error-handler v1.4.0
all-error-handler
АllЕrrorHandler provides you a object, which will listen for error events and then call a provided callback function.
АllЕrrorHandler package is exported as a UMD module.
Installation
In a browser:
<script src="node_modules/all-error-handler/index.min.js"></script>
In Node.js:
let AllErrorHandler = require("all-error-handler");
Usage
// Initialize object and pass a callback function to it
let errorHandler = new AllErrorHandler(err => {
console.log(`Error occured - ${err}`);
});
//Test
throw new Error("Foo"); // Error occured - Error: Foo
// at Object.<anonymous> ...
Params
new AllErrorHandler({Function}callback, {Boolean}startListening = true)
-- callback - pass a function which will be called after an Error is throwed.
-- startListening - if true it will start listining for the errors when the object is created.
Methods:
startListening();
-- Start listening for error events
errorHandler.startListening();
stopListening();
-- Stop listening for error events
errorHandler.stopListening();
dispose();
-- Call before setting the object to null to prevent memory leak
errorHandler.dispose();
errorHandler = null;
License
MIT
1.4.0
5 years ago
1.3.3
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
6 years ago
1.1.0
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
0.4.0
6 years ago
0.3.6
6 years ago
0.3.5
6 years ago
0.3.4
6 years ago
0.3.3
6 years ago
0.3.2
6 years ago
0.3.1
6 years ago
0.3.0
6 years ago
0.2.0
6 years ago
0.1.2
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago
1.0.0
6 years ago