1.0.9 • Published 1 year ago

@voodoo.io/reloader v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Reloader

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

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 : >= 14

VersionSupportedTested
18.xyesyes
16.xyesyes
14.xyesyes
12.xnoyes
10.xnoyes
9.xnoyes
8.xnoyes
>= 7.6noyes

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

Paramsdescription Default value
delayInterval in ms between two check, only60000 (1min)
one timer is used to check each function

Test

$ npm test

Coverage report can be found in coverage/.

1.0.9

1 year ago

1.0.8

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago