Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Latest commit

 

History

History
63 lines (50 loc) · 2.47 KB

timestamp.md

File metadata and controls

63 lines (50 loc) · 2.47 KB

Rx.Observable.prototype.timestamp([scheduler])

Records the timestamp for each value in an observable sequence.

Arguments

  1. [scheduler=Rx.Observable.timeout] (Scheduler): Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.

Returns

(Observable): An observable sequence with timestamp information on values.

Example

var source = Rx.Observable.timer(0, 1000)
    .timestamp()
    .map(function (x) { return x.value + ':' + x.timestamp; })
    .take(5);

var subscription = source.subscribe(
    function (x) {
        console.log('Next: ' + x);
    },
    function (err) {
        console.log('Error: ' + err);
    },
    function () {
        console.log('Completed');
    });

// => Next: 0:1378690776351
// => Next: 1:1378690777313
// => Next: 2:1378690778316
// => Next: 3:1378690779317
// => Next: 4:1378690780319
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: