title: Action based on visiblity and duration of element in viewport
body: <p>I am using IntersectionObserver to know whether a particular element is visible to the user or not. If it is visible then I am fetching some data from the server-side. Now I would like to know whether there is any API/approach to know how long an element is visible to the user.</p>
  <p>The use case that I am trying to solve is this - If an element is visible in the viewport for 5secs then fetch some data from the server.</p>
  <p>Thanks in advance.</p>