From 544172ddae6637395277a58e2128f3a7e674d6e4 Mon Sep 17 00:00:00 2001 From: Nathaniel Sabanski Date: Tue, 8 Oct 2024 17:21:12 -0700 Subject: [PATCH] Clarified some of the utilities. --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 10766b7..3f839a2 100644 --- a/README.md +++ b/README.md @@ -240,29 +240,29 @@ Looking for stuff [we recommend doing in vanilla JS](#no-surreal)? * 🔗 `enable` * 🔥 `me().enable()` * Opposite of `disable()` +* 🌐 `createElement` 🌗 `create_element` + * 🔥 `e_new = createElement("div"); me().prepend(e_new)` + * Alias of [document.createElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement) * 🌐 `sleep` * 🔥 `await sleep(1000, ev => { alert(ev) })` * `async` version of `setTimeout` * Wonderful for animation timelines. +* 🌐 `halt` + * 🔥 `halt(event)` + * When recieving an event, stop propagation, and prevent default actions (such as form submit). + * Wrapper for [stopPropagation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation) and [preventDefault](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) * 🌐 `tick` * 🔥 `await tick()` * `await` version of `rAF` / `requestAnimationFrame`. - * Animation tick. Waits 1 frame. - * Great if you need to wait for events to propagate. + * Waits for 1 frame (browser paint). + * Useful to guarantee CSS properties are applied, and events have propagated. * 🌐 `rAF` * 🔥 `rAF(e => { return e })` - * Animation tick. Fires when 1 frame has passed. Alias of [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) - * Great if you need to wait for events to propagate. + * Calls after 1 frame (browser paint). Alias of [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) + * Useful to guarantee CSS properties are applied, and events have propagated. * 🌐 `rIC` * 🔥 `rIC(e => { return e })` - * Great time to compute. Fires function when JS is idle. Alias of [requestIdleCallback](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback) -* 🌐 `halt` - * 🔥 `halt(event)` - * Prevent default browser behaviors. - * Wrapper for [preventDefault](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) -* 🌐 `createElement` 🌗 `create_element` - * 🔥 `e_new = createElement("div"); me().prepend(e_new)` - * Alias of vanilla `document.createElement` + * Calls when Javascript is idle. Alias of [requestIdleCallback](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback) * 🌐 `onloadAdd` 🌗 `onload_add` 🌗 `addOnload` 🌗 `add_onload` * 🔥 `onloadAdd(_ => { alert("loaded!"); })` * 🔥 ``