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 9df6ca1 commit 8125c9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ 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()`
* Add to `window.onload` while preventing overwrite of `window.onload` and predictable sequential loading.
* Add to `window.onload` while preventing overwrites of `window.onload` and predictable loading!
* Alternatives:
* Skip missing elements using `?.` example: `me("video")?.requestFullscreen()`
* Place `<script>` after the loaded element.
Expand Down

0 comments on commit 8125c9d

Please sign in to comment.