freya_core/
types.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
pub use accesskit::{
    Node as AccessibilityNode,
    NodeId as AccessibilityId,
};
use freya_native_core::{
    events::EventName,
    NodeId,
};
use ragnarok::ProcessedEvents;
use tokio::sync::{
    mpsc::{
        UnboundedReceiver,
        UnboundedSender,
    },
    watch,
};

use crate::{
    events::{
        DomEvent,
        PlatformEvent,
    },
    platform_state::NativePlatformState,
};

/// Send platform updates from the platform
pub type NativePlatformSender = watch::Sender<NativePlatformState>;

/// Receive updates by the platform
pub type NativePlatformReceiver = watch::Receiver<NativePlatformState>;

/// Emit events to the VirtualDOM
pub type EventEmitter =
    UnboundedSender<ProcessedEvents<NodeId, EventName, DomEvent, PlatformEvent>>;

/// Receive events to be emitted to the VirtualDOM
pub type EventReceiver =
    UnboundedReceiver<ProcessedEvents<NodeId, EventName, DomEvent, PlatformEvent>>;

/// Queued list of events to be processed by Freya.
pub type EventsQueue = Vec<PlatformEvent>;