1.0.5 • Published 7 months ago

@cfware/callback-array-once v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
7 months ago

@cfware/callback-array-once NPM Version

Run and clear an array of callbacks.

Usage

import runCallbacks from '@cfware/callback-array-once';

const cbs = [
	(arg1, arg2) => {
		console.log(arg1, arg2);
	},
	(arg1, arg2) => {
		console.log(arg1 + 1, arg2 + 1);
	}
];

runCallbacks(cbs, 1, 2);
console.log(cbs.length);
/* Prints:
 *   1 2
 *   2 3
 *   0
 */