use_device_pixel_ratio
Reactive window.devicePixelRatio
NOTE: there is no event listener for
window.devicePixelRatiochange. So this function uses the same mechanism as described in this example.
Demo
Usage
use leptos::prelude::*;
use leptos_use_device_pixel_ratio::use_device_pixel_ratio;
#[component]
fn Demo() -> impl IntoView {
let pixel_ratio = use_device_pixel_ratio();
view! { }
}
Server-Side Rendering
Make sure you follow the instructions in Server-Side Rendering.
On the server this function returns a Signal that is always 1.0.
Installation
cargo add leptos-use-device-pixel-ratio