How to Run Code in the Browser Console
How to Disable beforeunload Event Listeners
I was doing some troubleshooting and wanted to disable the “beforeunload” event listeners on a page. This is how I accomplished it with the Chrome browser.
WordPress Gutenberg Trigger Autosave
Recently, I was documenting the steps to reproduce a certain bug and the bug required the presence of an autosave (along with the “There is an autosave of this post that is more recent than the version below.” message). Rather than wait for an autosave to occur naturally, I wanted to speed things up and manually trigger one. This is the command I use to do that.
Display Keyboard Shortcut in WordPress Gutenberg
In Gutenberg (a.k.a. the WordPress Block Editor), keyboard shortcuts are displayed differently on Apple devices and other devices, e.g. ^H on an Apple device and Ctrl+H on other devices. This is accomplished with wp.keycodes.displayShortcut.
The “or” (||) operator and the “nullish coalescing operator” (??) can often be used in similar ways when reading a property from an object that may or may not exist. When dealing with strings you’re typically better off using “or” (||) and for numbers you’re typically better off using the “nullish coalescing operator” (??).
Promise and Async / Await
Making fetch calls with Promises vs async/await.