@jaenster/events
v0.9.7
Published
events - A nodejs like event system that is fully typed
Downloads
4
Readme
EventTS
import {EventTS} from "@jaenster/events-ts";
interface Foo {
on<S = this>(event: "bar", cb: (this: S, a: string) => any);
}
class Foo extends EventTS {
z: string = '';
}
const foo = new Foo;
foo.on('bar', function () {
// `this` is typed
if (this.z.length) {
// something
}
})