mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-23 17:09:21 -05:00
Added newer spawn paths
This commit is contained in:
parent
08884d75e0
commit
bbe4e66648
2 changed files with 2 additions and 3 deletions
|
@ -75,7 +75,6 @@ mod use_throttle_fn;
|
||||||
mod use_timeout_fn;
|
mod use_timeout_fn;
|
||||||
mod use_timestamp;
|
mod use_timestamp;
|
||||||
mod use_to_string;
|
mod use_to_string;
|
||||||
mod use_user_media;
|
|
||||||
mod use_web_notification;
|
mod use_web_notification;
|
||||||
mod use_websocket;
|
mod use_websocket;
|
||||||
mod use_window;
|
mod use_window;
|
||||||
|
|
|
@ -79,7 +79,7 @@ pub fn use_clipboard_with_options(
|
||||||
|
|
||||||
let update_text = move |_| {
|
let update_text = move |_| {
|
||||||
if is_supported.get() {
|
if is_supported.get() {
|
||||||
spawn_local(async move {
|
leptos::spawn::spawn_local(async move {
|
||||||
if let Some(clipboard) = window().navigator().clipboard() {
|
if let Some(clipboard) = window().navigator().clipboard() {
|
||||||
if let Ok(text) = js_fut!(clipboard.read_text()).await {
|
if let Ok(text) = js_fut!(clipboard.read_text()).await {
|
||||||
set_text.set(text.as_string());
|
set_text.set(text.as_string());
|
||||||
|
@ -102,7 +102,7 @@ pub fn use_clipboard_with_options(
|
||||||
let start = start.clone();
|
let start = start.clone();
|
||||||
let value = value.to_owned();
|
let value = value.to_owned();
|
||||||
|
|
||||||
spawn_local(async move {
|
leptos::spawn::spawn_local(async move {
|
||||||
if let Some(clipboard) = window().navigator().clipboard() {
|
if let Some(clipboard) = window().navigator().clipboard() {
|
||||||
if js_fut!(clipboard.write_text(&value)).await.is_ok() {
|
if js_fut!(clipboard.write_text(&value)).await.is_ok() {
|
||||||
set_text.set(Some(value));
|
set_text.set(Some(value));
|
||||||
|
|
Loading…
Add table
Reference in a new issue