- Extension function fromEmitterArgs has been refactored, to accept an optional tuple type, to make event arguments strongly-typed:
import {fromEmitterArgs} from 'sub-events/ext';
const e = new EventEmitter(); // our source/test emitter
type MyTuple = [number, string];
const onReceive = fromEmitterArgs<MyTuple>(e, 'receive'); // creating 'receive' event
onReceive.subscribe((data: MyTuple) => {
// data is strongly-typed here:
const s = data[0].toFixed(2); // 123.00
});
e.emit('receive', 123, 'hello'); // source emitter sends multiple arguments
- Minor refactoring + documentation updates.