You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've needed several times a convert a function into a emitter like this. I want to add a method to accommodate this. It would allow plain objects or functions to be made emitter-like by receiving properties (and methods) from the source emitter and thus would share listeners with the source.
My original concept was for the method was emitter.into(target) or static energy.into(target) but due to this shared data perhaps emitter.sync(target) or emitter.share(target) is clearer.
When I've used this technique, target has always never been an emitter already. How should that case be handled? Should the source's listeners cache overwrite a target's existing cache?
Activity
Sample `.into(target)` implementation for #3
ryanve commentedon May 3, 2014
When I've used this technique,
targethas always never been an emitter already. How should that case be handled? Should thesource's listeners cache overwrite atarget's existing cache?Chain `emitter.into(target) for #3 like the other emitter methods.
Simplify the name for #3 from `.into` to `.to`
ryanve commentedon May 3, 2014
I released 0.4.0 with static and instance forms of
.to(target)as above.Or use an
energy()object:Make emitters via energy.to(target) from energy 0.4.0: ryanve/energy#3