7.
まずはこの問題のコードを御覧ください
“side effect”は何回表示されるか?
var rx = require("rx");
var s = new rx.Subject();
var stream = s.tap(function(){console.log("side effect");});
stream.subscribeOnNext(function(){});
stream.subscribeOnNext(function(){});
s.onNext("foo");
ちょっと読みにくいので図にします
8.
図にしてみた
side effectは何回表示されるでしょうか?
subject tap(do)
side effect
message
onNext
nop
nop
9.
答え
2回
subject tap(do)
side effect
message
onNext
nop
nop
side effect
Be the first to comment