ofClass - richardszalay/raix GitHub Wiki
ο»ΏFilters out values that are not instances of a certain type (or a sub-class of that type)
function ofClass(valueClass : Class) : IObservable.<valueClass>As values are emitted from the source, they are checked to be instances of valueClass. If the value is an instance of valueClass or a subclass, the value is emitted; otherwise, the value is skipped.
The returned sequence completes when the source sequence completes.
The returned sequence errors when the source sequences errors.
xs = source
ys = output
true = value is instance of 'type'
false = value is not an instance of 'type'
xs ββoβββββoβββββoβββββoββββ/
β β β β β
true false false true β
β β β
ys ββoβββββββββββββββββoββββ/IObservable.<valueClass>
var source : IObservable = toObservable(
["first", 0, 1, 2, "second", "third"])
.ofType(String);
source.subscribe(function(value : Object) : void
{
trace(value);
});
// Trace output is:
// first
// second
// third