Skip to content

Module to prevent multiple calls to server or database for the same item at a time.

Notifications You must be signed in to change notification settings

wallsmetalroofing/gate-keeper

Repository files navigation

Gate-Keeper

npm i @walls/gate-keeper

Gate-Keeper will prevent duplicate calls with the same parameters. Instead it will wait for the first call to resolve and then resolve any later call with the identical value.

Add the module to file with this require statement.

const {GateKeeper} = require("@walls/gate-keeper");

Setup the method to get async results.

const get = GateKeeper( async (id) => {
    return await getFromServer(id);
});

Call to get a result

const file = await get(12);

Written with StackEdit.

About

Module to prevent multiple calls to server or database for the same item at a time.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •