Draft web platform structure
This commit is contained in:
parent
eea9530f38
commit
c5703eb00a
26 changed files with 1171 additions and 153 deletions
19
src/platform_impl/web/event_loop/proxy.rs
Normal file
19
src/platform_impl/web/event_loop/proxy.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use super::runner;
|
||||
use crate::event::Event;
|
||||
use crate::event_loop::EventLoopClosed;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Proxy<T: 'static> {
|
||||
runner: runner::Shared<T>,
|
||||
}
|
||||
|
||||
impl<T: 'static> Proxy<T> {
|
||||
pub fn new(runner: runner::Shared<T>) -> Self {
|
||||
Proxy { runner }
|
||||
}
|
||||
|
||||
pub fn send_event(&self, event: T) -> Result<(), EventLoopClosed> {
|
||||
self.runner.send_event(Event::UserEvent(event));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue