Event emitter which allows listeners to return a value.
This is beneficial for the themes since it allows plugins to modify the HTML output
without doing unsafe text replacement.
Very simple event emitter class which collects the return values of its listeners.
Example
constx = newEventHooks<{ a: [string] }, string>() x.on('a', a=>a.repeat(123)) // ok, returns a string x.on('b', console.log) // error, 'b' is not assignable to 'a' x.on('a'a=>1) // error, returns a number but expected a string
Event emitter which allows listeners to return a value.
This is beneficial for the themes since it allows plugins to modify the HTML output without doing unsafe text replacement.
Very simple event emitter class which collects the return values of its listeners.
Example