How it works...

When the start method is executed, it keeps the starting time using process.hrtime, which returns the current high-resolution real time in an array of two items, where the first item is a number that represents seconds while the second item is another number that represents nanoseconds. Then, it triggers all event listeners attached to the start event.

On the other side, when the stop method is executed, it uses the result of previously calling process.hrtime as an argument to the same function, which returns the difference in time. This is useful to measure the time from when the start method was called until the time when the stop method was called.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.62.25