Miss any of our Open RFC calls?Watch the recordings here! »

exclusive-process

1.1.2 • Public • Published

exclusive-process

Use this when you have a function that creates and returns a child process, and you want that process to be killed and recreated on successive calls so that there is only one process.

install

npm install exclusive-process

example

const exclusiveProcess = require('exclusive-process')
 
const fn = () => spawn('whatever')
const exclusiveFn = exclusiveProcess(fn)
 
exclusiveFn() // start process
exclusiveFn() // kill running process and start again

API

exclusiveProcess(fn)

  • fn: function a function that creates and returns a child process
  • returns: function a function that calls fn after killing the process from the previous call. Arguments are passed through to fn.

Install

npm i exclusive-process

DownloadsWeekly Downloads

2

Version

1.1.2

License

CC0-1.0

Last publish

Collaborators

  • avatar