I was working with a piece of code recently that made liberal use of the “Tap” operator on an observable. I’ve seen it used pretty often, but everytime I try
Current Behavior When passing a BehaviorSubject directly to the tap operator, subsequent subscriptions to the subject break. Using a function that calls .next instead for tap doesn't cause this problem.Expected behavior Passing a BehaviorSubject to tap should not break subsequent subscriptions to that ...
有几种方法可以做到这一点: 使用...-operator。 Client.on("event", () => { fx(...arguments);}); 使用call或apply:Client.on("event", () => { fx.apply(this, arguments);});Client.on("event", () => { fx.call(this, ...arguments);}); 直接使用函数:Client.on("event", fx); ...