[Implement] Naive basic EventEmitter class by jtenner · Pull Request #18 · AssemblyScript/node
Let me start by saying I realize how entirely dangerous this is. Currently there's no good ergonomic way to do this, and in order to implement the backbone of the Stream classes, we need something that resembles an emitter.
Current Limitations:
- Callback signatures must match runtime assertions
EventEmitteris treated asabstract- Callback parameters up to length
10 - callback must return
void - Emit still too large. Requires switch statement to determine callback argument length
- emit function doesn't match @types/node type arguments. It still requires explicit types
emitter.emit<A, B, C, D>(a: A, b: B, c: C, d: D); // etc.