Module leptos_dom::helpers
source · Expand description
A variety of DOM utility functions.
Structs
- Handle that is generated by request_animation_frame_with_handle and can be used to cancel the animation frame request.
- Handle that is generated by request_idle_callback_with_handle and can be used to cancel the idle callback.
- Handle that is generated by set_interval and can be used to clear the interval.
- Handle that is generated by set_timeout_with_handle and can be used to clear the timeout.
Functions
- “Debounce” a callback function. This will cause it to wait for a period of
delay
after it is called. If it is called again during that period, it will waitdelay
before running, and so on. This can be used, for example, to wrap event listeners to prevent them from firing constantly as you type. - Helper function to extract
Event.target
from any event. - Helper function to extract
event.target.checked
from an event. - Helper function to extract
event.target.value
from an event. - Gets the value of a property set on a DOM element.
- Returns the current
window.location
. - Current
window.location.hash
without the beginning #. - Current
window.location.pathname
. - Runs the given function between the next repaint using
Window.requestAnimationFrame
. - Runs the given function between the next repaint using
Window.requestAnimationFrame
, returning a cancelable handle. - Queues the given function during an idle period using
Window.requestIdleCallback
. - Queues the given function during an idle period using
Window.requestIdleCallback
, returning a cancelable handle. - set_intervalDeprecatedRepeatedly calls the given function, with a delay of the given duration between calls, returning a cancelable handle. See
setInterval()
. - Repeatedly calls the given function, with a delay of the given duration between calls, returning a cancelable handle. See
setInterval()
. - Sets a property on a DOM element.
- Executes the given function after the given duration of time has passed.
setTimeout()
. - Executes the given function after the given duration of time has passed, returning a cancelable handle.
setTimeout()
. - Adds an event listener to the
Window
.