Skip to content
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.

rootstream/_ARCHIVED-once

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

once

CircleCI

async friendly version of https://www.npmjs.com/package/once

usage

in your npm console:

npm install --save @rootstream/once

in your code:

const once = require('@rootstream/once');

async function sample() { /* ... */ };
// guarantees sample() is called only and only once during app's lifetime
const sampleOnce = once(sample)
// guarantees sample() is called only and only once during function's execution lifetime
const sampleOnceReentrant = once(sample, { reentrant: true })