Module utils

Module utils 

Source
Expand description

A catch all for project-wide macros and general-purpose functions that are not directly related to Perspective.

Modules below crate::utils strive to be single-responsibility, but some reference other crate::utils modules when it helps reduce boiler-plate.

Structs§

DebounceMutex
DebounceMutexData
PubSub
A pub/sub struct which allows many listeners to subscribe to many publishers, without leaking callbacks as listeners are dropped.
PubSubInternal
StatusIndicatorProps
Subscriber
Like a PubSub without PubSub::emit; the reciprocal of PubSub::callback. Subscriber does not keep the parent PubSub alive.
Subscription
Manages the lifetime of a listener registered to a PubSub<T> by deregistering the associated listener when dropped.
WeakScope
A mutable reference for capturing the Scope<_> props arguments, a useful function for tests.

Traits§

AddListener
AsBlob
CaretPosition
Utilities for caret position. DOM elements have different APIs for this but Deref makes them fall through, so it is important that this method be called on the correct struct type!
CustomElementMetadata
ScopeTExt
Tee
TeeInternal
Trait for polymorphic return value via turbofish-const-generic syntax.
ToFormattedString

Functions§

await_dom_loaded
An async which awaits the browser’s load event, which is automatically bypassed if document.readyState indicates this has already occurred.
await_queue_microtask
An async version of queueMicrotask(), curiously absent from web_sys.
define_web_component
download
posix_to_utc_str
request_animation_frame
An async version of requestAnimationFrame(), which resolves on the next animation frame.
set_timeout
An async version of set_timeout, which resolves in timeout milliseconds
str_to_utc_posix
use_async_callback
Just like use_callback, except convenient for an async cresult body.