Parse the query string as returned by `web_sys::window()?.location().search()?` and get a specific key out of it.
(query: &'a str, search_key: &str)
| 529 | /// Parse the query string as returned by `web_sys::window()?.location().search()?` and get a |
| 530 | /// specific key out of it. |
| 531 | pub fn parse_url_query_string<'a>(query: &'a str, search_key: &str) -> Option<&'a str> { |
| 532 | let query_string = query.strip_prefix('?')?; |
| 533 | |
| 534 | for pair in query_string.split('&') { |
| 535 | let mut pair = pair.split('='); |
| 536 | let key = pair.next()?; |
| 537 | let value = pair.next()?; |
| 538 | |
| 539 | if key == search_key { |
| 540 | return Some(value); |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | None |
| 545 | } |
| 546 | |
| 547 | pub trait Run: View + Sized { |
| 548 | fn run(self) { |