https://github.com/cfware/callback-array-once
Run and clear an array of callbacks
https://github.com/cfware/callback-array-once
Last synced: 9 months ago
JSON representation
Run and clear an array of callbacks
- Host: GitHub
- URL: https://github.com/cfware/callback-array-once
- Owner: cfware
- License: mit
- Created: 2019-03-22T19:27:58.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-10-15T15:20:02.000Z (over 2 years ago)
- Last Synced: 2025-06-22T11:37:48.083Z (10 months ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @cfware/callback-array-once [![NPM Version][npm-image]][npm-url]
Run and clear an array of callbacks.
## Usage
```js
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
*/
```
[npm-image]: https://img.shields.io/npm/v/@cfware/callback-array-once.svg
[npm-url]: https://npmjs.org/package/@cfware/callback-array-once