Javatpoint Logo
Javatpoint Logo

RxJS timestamp() Utility Operator

RxJS timestamp() operator is a utility operator used to return the timestamp and the value emitted from the source observable. It tells about the time when the value was emitted.

We can say that the RxJS timestamp() operator attaches a timestamp to each item emitted by the source observable, which also indicates the time when it was emitted.

Syntax:

Following is the syntax of the RxJS timestamp() utility operator:

Or

Parameter Explanation

  • scheduler: This is an optional argument. Its default value is async. Type: SchedulerLike.

Return value

The RxJS timestamp() operator returns the timestamp and the value emitted from the source observable, which also specifies the time when the value was emitted.

Let us see some examples of the RxJS timestamp() operator to understand it clearly.

Example 1

Output:

After executing the above example, you will see the following result:

RxJS timestamp() Utility Operator

Example 2 (Timestamp attached to the documents along with click event)

Output:

After executing the above example, you will see the following result:

RxJS timestamp() Utility Operator

In the above example, you can see that when you click on the RxJS playground after running the code, it shows the timestamp values.


Next TopicRxJS Operators




Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA