What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-16 10:16:18
ublock reddit promoted posts
// ==UserScript== // @name Washington Post Paywall Bypass // @namespace https://greasyfork.org/users/673609 // @version 0.9.9.2 // @description Bypass Washington Post paywall. // @match https://www.washingtonpost.com/* // @grant ... Add solution -
Javascript 2021-11-15 08:40:37
typescript emit custom event
//Listen for the event window.addEventListener("MyEventType", function(evt) { alert(evt.detail); }, false); //Dispatch an event var evt = new CustomEvent("MyEventType", {detail: "Any Object Here"}); window.dispatchEvent(... Add solution -
Javascript 2021-11-14 17:15:21
window onload javascript
//two ways of executing JS code after page is loaded, use "DOMContentLoaded" when able document.addEventListener("DOMContentLoaded", function(){ //dom is fully loaded, but maybe waiting on images & css files }); window.... Add solution -
Javascript 2021-11-12 23:53:15
javascript debounce function
// Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of ... Add solution -
Javascript 2021-11-12 14:45:22
react prevent back
const preventBack = (): void => { window.history.pushState(null, "", window.location.pathname); } const handleBack = (): void => { console.log('handleBack') } useEffect(() => { preventBack(); window.addEventListener('popstate'... Add solution -
Javascript 2021-11-10 02:26:07
window onload
//two ways of executing JS code after page is loaded, use "DOMContentLoaded" when able document.addEventListener("DOMContentLoaded", function(){ //dom is fully loaded, but maybe waiting on images & css files }); window.... Add solution -
Javascript 2021-11-07 19:02:16
listen to document height changes
// create an Observer instance const resizeObserver = new ResizeObserver(entries => console.log('Body height changed:', entries[0].target.clientHeight) ) // start observing a DOM node resizeObserver.observe(document.body) // click anywhere to rnad... Add solution
Best helpers
Ranking is empty