combine3
을 구현하는 쉬운 방법이 있습니까? 더미 onValue()
소비자가 존재하지 않는 combineWith
혼자 작동하지 않습니다.Bacon.js의 3 개 속성에 대해
var Bacon = require('baconjs')
function emit(delay)
{
var s = new Bacon.Bus()
setTimeout(function()
{
console.log("emit", delay)
s.push(delay)
}, delay)
return s.toProperty()
}
var foo = emit(500)
var bar = emit(1000)
var baz = emit(1500)
function consume(foo, bar, baz)
{
console.log("consumed", foo, bar, baz)
}
function combine3(consume, foo, bar, quux)
{
Bacon.combineWith(function (foo, bar, quux)
{
return { foo : foo, bar : bar, quux : quux }
}, foo, bar, quux)
.onValue(function (x)
{
consume(x.foo, x.bar, x.quux)
})
}
combine3(consume, foo, bar, baz)
참고 :
Bacon.combineWith(consume, foo, bar, baz).onValue(function() {})
해결 방법은 여전히 해킹처럼 보인다. 다음 3 개 버전 consume()
를 호출하지 않는다 : 손
Bacon.when([foo, bar, baz], consume)
Bacon.update(911, [foo, bar, baz], consume)
Bacon.zipWith(foo, bar, baz, consume)
작업은 3 개 개의 매개 변수를 기반으로 HTML 테이블을 필터링하는 것입니다. 따라서 consume
은 현재 선택된 필터링 조건을 기반으로 테이블을 그리고 새로운 Observables
을 생성하지 않습니다.
또한 더 간단한 방법으로 emit()
을 작성 하시겠습니까?
것입니까? – raimohanska
'combineWith'만으로는 작동하지 않습니다. 내 질문을 업데이트했습니다. – nponeccop
emit()과 관련하여 Bacon.later()를 사용할 수 있습니다. – raimohanska