-
Notifications
You must be signed in to change notification settings - Fork 8
timeInterval
richardszalay edited this page Sep 14, 2010
·
13 revisions
Outputs the original value wrapped in a TimeInterval object which adds the amount of time that passed since the previous value was emitted
function timeInterval(type : Class, scheduler : IScheduler = null) : IObservable
The returned sequence completes when the source sequence completes.
The returned sequence raises an error if the source sequence raises an error.
ts1, ts2 = time between values x,<interval> = TimeInterval with x as value and <interval> as interval
xs ──o─────o─────o───/ │ ti1 │ ti2 │ │ │-----│-----│---│ ys ──o─────o─────o───/ x,0 x,ti1 x,ti2
Unless specified, Scheduler.synchronous
will be used to determine the current time
IObservable.<TimeInterval>
Observable.interval(1000).timeInterval()
.subscribe(
function(ti : TimeInterval) : void { trace(ti.value.toString() + " - " + ti.interval.toString()); }
);
// Trace output is:
// 0 - 1000
// 1 - 1000
// 2 - 1000
// 3 - 1000
// ...