0.2.2 • Published 5 years ago

@reix/bits v0.2.2

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

Bits

Bit-related utilites for the reix game engine

Usage

BitFieldEmitter

import { BitFieldEmitter } from '@reix/bits'

// create emitter
const emitter = new BitFieldEmitter<number>()

// each listener gets a data and a code parameter
const handler = (data: number, code: number) => console.log('fired')

emitter.on(0b011, handler)

// second param can be any number you want to pass to the handlers, I just like the digit 7:)
emitter.emit(0b001, 7) // fired
emitter.emit(0b100, 7) // nothing...
emitter.emit(0b101, 7) // fired
emitter.emit(0b110, 7) // fired
0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.3

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago