Skip to content

Commit

Permalink
Added usage, alternative patterns of onloadAdd
Browse files Browse the repository at this point in the history
  • Loading branch information
gnat authored Jul 6, 2024
1 parent 6b2e075 commit 0b6a6df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ Looking for stuff [we recommend doing in vanilla JS](#no-surreal)?
* 🔥 `onloadAdd(_ => { alert("loaded!"); })`
* 🔥 `<script>let e = me(); onloadAdd(_ => { me(e).on("click", ev => { alert("clicked") }) })</script>`
* Execute after the DOM is ready. Similar to jquery `ready()`
* Adds function to `window.onload` to prevent overwrites of `window.onload` and predictable sequential loading.
* Alternative patterns
* Add to `window.onload` while preventing overwrite of `window.onload` and predictable sequential loading.
* Alternatives:
* Skip missing elements using `.?` example: `me("video")?.requestFullscreen()`
* Place `<script>` after the loaded element.
* See `me('-')` / `me('prev')`
Expand Down

0 comments on commit 0b6a6df

Please sign in to comment.