-
Notifications
You must be signed in to change notification settings - Fork 408
fix: fluent interface for EventEmitter #475
Conversation
const zoneAwareAddListener = makeZoneAwareAddListener(EE_ADD_LISTENER, EE_REMOVE_LISTENER, false, true); | ||
const zoneAwarePrependListener = makeZoneAwareAddListener(EE_PREPEND_LISTENER, EE_REMOVE_LISTENER, false, true); | ||
const zoneAwareRemoveListener = makeZoneAwareRemoveListener(EE_REMOVE_LISTENER, false); | ||
const zoneAwareAddListener = makeZoneAwareAddListener(EE_ADD_LISTENER, EE_REMOVE_LISTENER, false, true, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO adding a "magic" boolean param is not the best way to to this.
Can you add makeChainable...
that wraps the underlying method and return self ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let me know what you think now!
3c04170
to
292558f
Compare
@@ -363,3 +363,9 @@ export function patchMethod(target: any, name: string, | |||
return delegate; | |||
} | |||
|
|||
export function makeNamedFnChainable(fn: (self: any, args: any[]) => any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- pls move this fn where it is used (ie
events.ts
). - use arrow fn,
- wouldn't
callAndReturnFirstParam(...)
be more explicit ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer named functions, because stack trace when debugging, but I've got nothing against good policies!
angular/universal#568 |
@vicb, @JakubMal ?? I waiting for this P.R, because wallabyjs/public#814 |
Sorry, I was short on time lately, I should be able get this ready this week!
|
292558f
to
f65630b
Compare
All issues addressed! :) |
@alxhub ? |
I'm hoping this PR will fix my |
@spenoir, yes this has been released. |
Fixes #470 by returning self from
addListener
,on
,prependListener
,removeListener
in Node.js.