RxJS delay() Utility OperatorRxJS delay() operator is a utility operator used to delay the values emitted from the source observable according to a timeout given or by the specified delay value until a given Date. In other words, you can say that the RxJS delay() operator is used to delay or time shift each item by some specified amount of milliseconds. Syntax:Following is the syntax of the RxJS delay() operator: Or Parameter ExplanationThe RxJS delay() operator generally takes up to 2 arguments.
Return valueThe RxJS delay() operator's return value is observable that delays the source observable emissions by the specified timeout or Date. Let us see some examples of the RxJS delay() operator to understand it clearly. Example 1 (Delay for increasing durations)Output: After executing the above example, you will see the following result: In the above example, you can see that every emitted value has been delayed by 1 second. Example 2 (Delay to recognize long press)Index.html: Output: After executing the above example, you will see the following result: In the above example, when you click on the RxJS playground for a long time (700 millisecond) , you will see the result on the console.
Next TopicRxJS Operators
|