can.offKeyValue
Used by can-reflect.offKeyValue to stop listening to when the underlying stream emits either a value or error with a new value.
stream[@@can.offKeyValue](key, handler)
can-reflect.offKeyValue will use this function
to stop listening to when emitted values or errors change.
var Kefir = require("can-kefir");
var count = Kefir.sequentially(1000, [1, 2, 2, 3]);
function handler(newVal) {
console.log("new value", newVal); // logs 1, 2
if(newVal > 2) {
canReflect.offKeyValue(stream, "value", handler);
}
}
canReflect.onKeyValue(stream, "value", handler);
Parameters
- key
{String}:Either
valuefor values emitted by the stream orerroror error values emitted by the stream. - handler
{function(value)}:The same handler passed to
onKeyValue.