Created
February 24, 2021 16:57
-
-
Save c-j-j/5ff6bea351d676e22231045fd4ad4b6f to your computer and use it in GitHub Desktop.
Chrome extension: CLS Logger
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
console.log("MONITORING CLS") | |
let cls = 0; | |
new PerformanceObserver((entryList) => { | |
for (const entry of entryList.getEntries()) { | |
if (!entry.hadRecentInput) { | |
cls += entry.value; | |
console.log('Current CLS value:', cls, entry); | |
} | |
} | |
}).observe({type: 'layout-shift', buffered: true}); |
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
{ | |
"name": "CLS Monitoring", | |
"version": "1.0", | |
"description": "Monitors CLS on a page", | |
"content_scripts": [ | |
{ | |
"matches": [ | |
"https://www.example.co.uk/*" | |
], | |
"run_at": "document_start", | |
"js": [ | |
"contentScript.js" | |
] | |
} | |
], | |
"manifest_version": 2, | |
"permissions": [ | |
"activeTab" | |
] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment