Navy Penguin Mariachi

    @voodoo.io/reloader
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.8 • Public • Published
    Reloader


    npm version GitHub license CI pipeline Opened issues Opened PR DeepScan grade Code coverage Dependencies

    Purpose

    Minimalist, efficient and performance focused module to run a function at a specific interval.

    Compatibility

    /!\ This module use async/await syntax, this is why you must have node 7.6+.

    Supported and tested : >= 7.6

    Version Supported Tested
    16.x yes yes
    14.x yes yes
    12.x yes yes
    10.x yes yes
    9.x yes yes
    8.x yes yes
    >= 7.6 yes yes

    Installation

    $ npm install @voodoo.io/reloader --save

    Usage

    Instantiation & init

    const ConfigManager = require('@voodoo.io/reloader')
    const configManager = new ConfigManager()
    
    // create a config function that should be run every 2 seconds
    configManager.addFunction("config", async () => {
      // my stuff to reload here ....
    }, 2000)
    
    await configManager.init()

    Basic usage

    If your function returns a result it's accessible through "get" method.

    configManager.get('config')
    // or
    configManager.getAll()

    Constructor params

    Params description  Default value
    delay Interval in ms between two check, only 60000 (1min)
    one timer is used to check each function

    Test

    $ npm test

    Coverage report can be found in coverage/.

    Install

    npm i @voodoo.io/reloader

    DownloadsWeekly Downloads

    3

    Version

    1.0.8

    License

    MIT

    Unpacked Size

    6.69 kB

    Total Files

    4

    Last publish

    Collaborators

    • voodooio
    • chonne
    • vincentvallet_voodoo
    • clintvoodoo
    • clementc
    • raphaelyazdi