- Performance API provides helpful numbers to measure performance of a webpage.
- In this demo, “We will learn about performance API”.
- This performance object can be accessible using window.performance object.The following screenshot shows the object model of window.performance object.
- In the previous screenshot you can see 3 performance propertied memory,navigation and timing.
- The memory contains information about the total, used and limit of memory usage.The following screenshot show the window.performance.memory object model:-
- The navigation contains 2 properties redirectCount and type.The following screenshot shows the window.performance.navigation object model:-
- The window.performance.navigation.type can have value 0, 1, 2 and 255.The 0 indicates the page is loaded by a user click on a link or entering URL in user agent. The 1 indicates the page is loaded by a reload operation. The 2 indicates the page is loaded by using forward and backward button by history traversal. The 255 indicates other type of reload which is not defined.
- The timing property contains timing information of various things ling DOM loading, DNS lookup etc.The following screenshot shows the object model of window.performance.timing:-