Obtain the web page first screen paint(fsp) time automatically, non-implanted. blog
npm install first-screen-paint --save
cd first-screen-paint
npm install
npm run dev
// import as a module
import 'first-screen-paint'
// or add as a script
<script src="./first-screen-paint/dist/index.js"></script>
// Obtain the FSP time anywhere
if (window.$fstp) {
$fstp.getFirstScreenTime().then((data) => {
console.log(data)
})
}
api | desc | params |
---|---|---|
getFirstScreenTime | obtian FSP time | delay:[Number]5000(default), stop: [Bollean]true(default) |
getRequestTime | obtain resource time with white list | format: [RegExp], delay:[Number]5000(default), stop: [Bollean]true(default) |
reopen | reopen listiner | ele: [Element]document(default) |