From d0f79d2779d00752eef78cd98b6904cd888d59e3 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 23 Nov 2019 20:23:38 +0100 Subject: Make `tour` work with `iced_web` again :tada: - Implements `TextInput`, `Scrollable`, and `Container` - Adds basic style generation --- src/application.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/application.rs b/src/application.rs index 5ecb901e..d761c990 100644 --- a/src/application.rs +++ b/src/application.rs @@ -140,7 +140,7 @@ pub trait Application: Sized { as iced_winit::Application>::run(); #[cfg(target_arch = "wasm32")] - iced_web::Application::run(Instance(self)); + as iced_web::Application>::run(); } } @@ -180,11 +180,21 @@ where { type Message = A::Message; - fn update(&mut self, message: Self::Message) { - self.0.update(message); + fn new() -> (Self, Command) { + let (app, command) = A::new(); + + (Instance(app), command) } - fn view(&mut self) -> Element { + fn title(&self) -> String { + self.0.title() + } + + fn update(&mut self, message: Self::Message) -> Command { + self.0.update(message) + } + + fn view(&mut self) -> Element<'_, Self::Message> { self.0.view() } } -- cgit From 9f3abe920271996cc4a9c533ad5e0e75e3d18a3d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 24 Nov 2019 11:25:14 +0100 Subject: Spawn `Command` futures in `iced_web` --- src/application.rs | 2 +- src/sandbox.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/application.rs b/src/application.rs index d761c990..f6d3fb90 100644 --- a/src/application.rs +++ b/src/application.rs @@ -83,7 +83,7 @@ pub trait Application: Sized { /// The type of __messages__ your [`Application`] will produce. /// /// [`Application`]: trait.Application.html - type Message: std::fmt::Debug + Send; + type Message: std::fmt::Debug + Send + Clone; /// Initializes the [`Application`]. /// diff --git a/src/sandbox.rs b/src/sandbox.rs index 698578f4..60e3be14 100644 --- a/src/sandbox.rs +++ b/src/sandbox.rs @@ -81,7 +81,7 @@ pub trait Sandbox { /// The type of __messages__ your [`Sandbox`] will produce. /// /// [`Sandbox`]: trait.Sandbox.html - type Message: std::fmt::Debug + Send; + type Message: std::fmt::Debug + Send + Clone; /// Initializes the [`Sandbox`]. /// -- cgit