Created
June 29, 2018 15:53
-
-
Save hakimelek/55c8c79856ccbed995394a63b216e4d0 to your computer and use it in GitHub Desktop.
Detect Latest Image loaded on the page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const imagePath = '/path/to/image' | |
let latestImageTiming = 0 | |
const p = window.performance.getEntriesByType('resource') | |
p.filter(e => { e.name.indexOf(imagePath) >= 0 && (latestImageTiming = Math.max(latestImageTiming, e.responseEnd))}) | |
console.log(latestImageTiming) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment