@rbxts/callback-pool
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Callback Pool

Includes a CallbackPool class, than, when drained, will execute all functions currently in it's pool and then remove them from the pool.

import { CallbackPool } from "@rbxts/callback-pool"

const MyPool = new CallbackPool([
    () => {
        print("First function ran!")
    },
    () => {
        print("Second function ran!")
    }
])

/*
    Expected output:
        - First function ran!
        - Second function ran!
*/
MyPool.Drain()

MyPool.Add(() => {
    print("Third function ran!")
}).Add(() => {
    print("Fourth function ran!")
})

/*
    Expected output:
        - Third function ran!
        - Fourth function ran!
*/
MyPool.Drain()

Readme

Keywords

none

Package Sidebar

Install

npm i @rbxts/callback-pool

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

3.26 kB

Total Files

4

Last publish

Collaborators

  • typechecked