Skip to content

Commit

Permalink
Fix cfg_match! usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
teymour-aldridge committed Jun 26, 2020
1 parent aaaf298 commit 51ce041
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions yew/src/services/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,18 @@ impl DialogService {
pub fn prompt(message: &str, default: Option<&str>) -> Option<String> {
cfg_match! {
feature = "std_web" => compile_error!("The `prompt` method is not supported for `stdweb`."),
feature = "web_sys" => if let Some(default) = default {
utils::window().prompt_with_message_and_default(message, default).expect("Couldn't read input.")
}
else {
utils::window().prompt_with_message(message).expect("Couldn't read input.")
}
feature = "web_sys" => ({
if let Some(default) = default {
utils::window()
.prompt_with_message_and_default(message, default)
.expect("Couldn't read input.")
}
else {
utils::window()
.prompt_with_message(message)
.expect("Couldn't read input.")
}
})
}
}
}

0 comments on commit 51ce041

Please sign in to comment.