@@ -59,6 +59,7 @@ use dodrio::bumpalo;
5959use std:: { cell:: RefCell , rc:: Rc } ;
6060
6161mod bus;
62+ mod clipboard;
6263mod element;
6364mod hasher;
6465
@@ -67,6 +68,7 @@ pub mod subscription;
6768pub mod widget;
6869
6970pub use bus:: Bus ;
71+ pub use clipboard:: Clipboard ;
7072pub use css:: Css ;
7173pub use dodrio;
7274pub use element:: Element ;
@@ -126,7 +128,11 @@ pub trait Application {
126128 /// this method.
127129 ///
128130 /// Any [`Command`] returned will be executed immediately in the background.
129- fn update ( & mut self , message : Self :: Message ) -> Command < Self :: Message > ;
131+ fn update (
132+ & mut self ,
133+ message : Self :: Message ,
134+ clipboard : & mut Clipboard ,
135+ ) -> Command < Self :: Message > ;
130136
131137 /// Returns the widgets to display in the [`Application`].
132138 ///
@@ -156,6 +162,8 @@ pub trait Application {
156162 let document = window. document ( ) . unwrap ( ) ;
157163 let body = document. body ( ) . unwrap ( ) ;
158164
165+ let mut clipboard = Clipboard :: new ( ) ;
166+
159167 let ( sender, receiver) =
160168 iced_futures:: futures:: channel:: mpsc:: unbounded ( ) ;
161169
@@ -182,7 +190,8 @@ pub trait Application {
182190
183191 let event_loop = receiver. for_each ( move |message| {
184192 let ( command, subscription) = runtime. enter ( || {
185- let command = application. borrow_mut ( ) . update ( message) ;
193+ let command =
194+ application. borrow_mut ( ) . update ( message, & mut clipboard) ;
186195 let subscription = application. borrow ( ) . subscription ( ) ;
187196
188197 ( command, subscription)
0 commit comments