Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: Leopold Luley <[email protected]>
  • Loading branch information
cmyr and luleyleo committed Apr 15, 2020
1 parent 81d3abc commit 185941d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions docs/book_examples/src/custom_widgets_md.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ impl TextBoxActionController {
pub fn new() -> Self {
TextBoxActionController { timer: None }
}

// Fire ACTION after 300 ms
fn deadline() -> Instant {
Instant::now() + DELAY
}
}

impl Controller<String, TextBox> for TextBoxActionController {
Expand All @@ -68,7 +63,7 @@ impl Controller<String, TextBox> for TextBoxActionController {
ctx.submit_command(ACTION, None);
}
Event::KeyUp(k) if k.key_code != KeyCode::Return => {
self.timer = Some(ctx.request_timer(Self::deadline()));
self.timer = Some(ctx.request_timer(Instant::now() + DELAY));
child.event(ctx, event, data, env);
}
Event::Timer(token) if Some(*token) == self.timer => {
Expand Down

0 comments on commit 185941d

Please sign in to comment.