1.0.1 • Published 5 years ago

function-batcher v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Function Batcher

A simple utility for batch executing a group of functions.

Usage

// ES module is in /src/function-batcher.js
import FunctionBatcher from 'function-batcher'
<script type='text/javascript' src='/dist/function-batcher.js'></script>
<script type='text/javascript' src='/dist/function-batcher.min.js'></script>
function f() {
  console.log(1)
}

function g() {
  console.log(2)
}

batch = FunctionBatcher()

batch.add(f)
batch.add(g)
batch.run()
// => 1
//    2

batch.remove(f)
batch.run()
// => 2

License

MIT