Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add send_self_batch to ComponentLink #748

Merged
merged 1 commit into from
Nov 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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