Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cfware/callback-array-once
Run and clear an array of callbacks
https://github.com/cfware/callback-array-once
Last synced: 29 days 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 (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-15T15:20:02.000Z (about 1 year ago)
- Last Synced: 2024-11-06T15:09:43.313Z (about 2 months ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- 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