Nihilist Pocket Monsters

    all-error-handler
    TypeScript icon, indicating that this package has built-in type declarations

    1.4.0 • Public • Published

    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.

    code style: prettier npm downlodas Build Status devDependencies Status Known Vulnerabilities

    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

    Install

    npm i all-error-handler

    DownloadsWeekly Downloads

    2

    Version

    1.4.0

    License

    MIT

    Unpacked Size

    6.33 kB

    Total Files

    5

    Last publish

    Collaborators

    • jkanchelov