Skip to content

Wrap functions in a semaphore with ES6 Proxy functions#35

Open
kgullion wants to merge 1 commit into
DirtyHairy:masterfrom
kgullion:master
Open

Wrap functions in a semaphore with ES6 Proxy functions#35
kgullion wants to merge 1 commit into
DirtyHairy:masterfrom
kgullion:master

Conversation

@kgullion

@kgullion kgullion commented Mar 6, 2021

Copy link
Copy Markdown

Takes any function and wraps that function in a runExclusive so that any future calls to the wrapped function are deferred.

eg
const wrappedLog = lock.wrap(console.log) const release = lock.aquire() wrappedLog("this won't print until release is called") setTimeout(release, 1000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant