cool-cool-object-pool

1.0.0 • Public • Published

Cool Cool Object Pool

the teeny-tiny, zero-dependency object pool module

installation:

npm install cool-cool-object-pool --save

example usage:

const ObjectPool = require(`cool-cool-object-pool`)

const particle_pool = ObjectPool({
    create: particle_skin => {
        const particle = new Particle(particle_skin) // some canvas obj or physics obj
        initParticle(particle)
        return particle
    },

    reset: initParticle,

    starting_num: 100,
})

const initParticle = particle => {
    // maybe set world model values like x & y coords
    // maybe kick off some tweens & set particle_pool.putObj as the completion callback
}

Readme

Keywords

Package Sidebar

Install

npm i cool-cool-object-pool

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

1.86 kB

Total Files

3

Last publish

Collaborators

  • biyangdo