Fixing build errors

This commit is contained in:
Pauan 2021-10-17 10:49:43 +02:00
parent 1dc28869e1
commit e9e9e61ed8
5 changed files with 13 additions and 11 deletions

View File

@ -23,7 +23,7 @@ crate-type = ["cdylib"]
[dependencies]
console_error_panic_hook = "0.1.6"
dominator = "0.5.18"
dominator = "0.5.21"
wasm-bindgen = "0.2.74"
futures-signals = "0.3.20"
serde_json = "1.0.64"

View File

@ -5,7 +5,7 @@ use web_sys::{Url, HtmlInputElement};
use serde_derive::{Serialize, Deserialize};
use futures_signals::signal::{Signal, SignalExt, Mutable};
use futures_signals::signal_vec::{SignalVec, SignalVecExt, MutableVec};
use dominator::{Dom, text_signal, html, clone, events, link, with_node, routing};
use dominator::{Dom, EventOptions, text_signal, html, clone, events, link, with_node, routing};
use crate::todo::Todo;
use crate::util::{trim, local_storage};
@ -167,7 +167,7 @@ impl App {
}))
})
.event_preventable(clone!(app => move |event: events::KeyDown| {
.event_with_options(&EventOptions::preventable(), clone!(app => move |event: events::KeyDown| {
if event.key() == "Enter" {
event.prevent_default();
app.create_new_todo();

View File

@ -113,7 +113,7 @@ impl Todo {
])
}),
html!("input", {
html!("input" => HtmlInputElement, {
.class("edit")
.prop_signal("value", todo.editing.signal_cloned()
@ -136,9 +136,11 @@ impl Todo {
}))
})
.event(clone!(todo => move |event: events::Input| {
todo.editing.set_neq(Some(event.value().unwrap_throw()));
}))
.with_node!(element => {
.event(clone!(todo => move |_: events::Input| {
todo.editing.set_neq(Some(element.value()));
}))
})
.event(clone!(todo, app => move |_: events::Blur| {
todo.done_editing(&app);

View File

@ -494,7 +494,7 @@ impl<A> DomBuilder<A> {
// TODO add this to the StylesheetBuilder and ClassBuilder too
#[inline]
pub fn global_event<T, F>(mut self, listener: F) -> Self
pub fn global_event<T, F>(self, listener: F) -> Self
where T: StaticEvent,
F: FnMut(T) + 'static {
self.global_event_with_options(&EventOptions::default(), listener)
@ -503,7 +503,7 @@ impl<A> DomBuilder<A> {
// TODO add this to the StylesheetBuilder and ClassBuilder too
#[deprecated(since = "0.5.21", note = "Use global_event_with_options instead")]
#[inline]
pub fn global_event_preventable<T, F>(mut self, listener: F) -> Self
pub fn global_event_preventable<T, F>(self, listener: F) -> Self
where T: StaticEvent,
F: FnMut(T) + 'static {
self.global_event_with_options(&EventOptions::preventable(), listener)

View File

@ -76,7 +76,7 @@ pub fn on_click_go_to_url<A, B>(new_url: A) -> impl FnOnce(DomBuilder<B>) -> Dom
#[inline]
move |dom| {
dom.event_preventable(move |e: events::Click| {
dom.event_with_options(&EventOptions::preventable(), move |e: events::Click| {
e.prevent_default();
go_to_url(&new_url);
})
@ -108,7 +108,7 @@ macro_rules! on_click_go_to_url {
($this:ident, $url:expr) => {{
let url = $url;
$this.event_preventable(move |e: $crate::events::Click| {
$this.event_with_options(&$crate::EventOptions::preventable(), move |e: $crate::events::Click| {
e.prevent_default();
$crate::routing::go_to_url(&url);
})