Skip to content

Commit

Permalink
Add send_self_batch to ComponentLink (yewstack#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
hgzimmerman authored and llebout committed Jan 20, 2020
1 parent 16ba841 commit b35a246
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/html/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ where
closure.into()
}

#[cfg(all(target_arch = "wasm32", not(target_os="wasi"), not(cargo_web)))]
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi"), not(cargo_web)))]
/// This method processes a Future that returns a message and sends it back to the component's
/// loop.
///
Expand Down Expand Up @@ -441,6 +441,15 @@ where
pub fn send_self(&mut self, msg: COMP::Message) {
self.scope.send_message(msg);
}

/// Sends a batch of messages to the component to be processed immediately after
/// the component has been updated and/or rendered..
///
/// All messages will first be processed by `update`, and if _any_ of them return `true`,
/// then re-render will occur.
pub fn send_self_batch(&mut self, msgs: Vec<COMP::Message>) {
self.scope.send_message_batch(msgs)
}
}

impl<COMP: Component> fmt::Debug for ComponentLink<COMP> {
Expand Down

0 comments on commit b35a246

Please sign in to comment.