wip: close on putting it all together
just gotta tie a bow
This commit is contained in:
1 parent
c1afeba1ef
commit
85e2dc259a
9 files changed
+406
-360
No files matched your search
+20
-32
@@ -58,32 +58,40 @@ impl Ord for EventKey {
|
||||
/// implement this form of scheduling internally, however Dioxus will perform its own scheduling as well.
|
||||
///
|
||||
/// The ultimate goal of the scheduler is to manage latency of changes, prioritizing "flashier" changes over "subtler" changes.
|
||||
///
|
||||
/// React has a 5-tier priority system. However, they break things into "Continuous" and "Discrete" priority. For now,
|
||||
/// we keep it simple, and just use a 3-tier priority system.
|
||||
///
|
||||
/// - NoPriority = 0
|
||||
/// - LowPriority = 1
|
||||
/// - NormalPriority = 2
|
||||
/// - UserBlocking = 3
|
||||
/// - HighPriority = 4
|
||||
/// - ImmediatePriority = 5
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, PartialOrd, Ord)]
|
||||
pub enum EventPriority {
|
||||
/// Garbage collection is a type of work than can be scheduled around other work, but must be completed in a specific
|
||||
/// order. The GC must be run for a component before any other future work for that component is run. Otherwise,
|
||||
/// we will leak slots in our slab.
|
||||
///
|
||||
/// Garbage collection mixes with the safety aspects of the virtualdom so it's very important to get it done before
|
||||
/// other work.
|
||||
GarbageCollection,
|
||||
|
||||
/// "High Priority" work will not interrupt other high priority work, but will interrupt long medium and low priority work.
|
||||
///
|
||||
/// This is typically reserved for things like user interaction.
|
||||
High,
|
||||
///
|
||||
/// React calls these "discrete" events, but with an extra category of "user-blocking".
|
||||
High = 2,
|
||||
|
||||
/// "Medium priority" work is generated by page events not triggered by the user. These types of events are less important
|
||||
/// than "High Priority" events and will take presedence over low priority events.
|
||||
///
|
||||
/// This is typically reserved for VirtualEvents that are not related to keyboard or mouse input.
|
||||
Medium,
|
||||
///
|
||||
/// React calls these "continuous" events (e.g. mouse move, mouse wheel, touch move, etc).
|
||||
Medium = 1,
|
||||
|
||||
/// "Low Priority" work will always be pre-empted unless the work is significantly delayed, in which case it will be
|
||||
/// advanced to the front of the work queue until completed.
|
||||
///
|
||||
/// The primary user of Low Priority work is the asynchronous work system (suspense).
|
||||
Low,
|
||||
///
|
||||
/// This is considered "idle" work or "background" work.
|
||||
Low = 0,
|
||||
}
|
||||
|
||||
impl EventTrigger {
|
||||
@@ -103,21 +111,6 @@ impl EventTrigger {
|
||||
}
|
||||
|
||||
pub enum VirtualEvent {
|
||||
/// Generated during diffing to signal that a component's nodes to be given back
|
||||
///
|
||||
/// Typically has a high priority
|
||||
///
|
||||
/// If an event is scheduled for a component that has "garbage", that garabge will be cleaned up before the event can
|
||||
/// be processed.
|
||||
GarbageCollection,
|
||||
|
||||
/// A type of "immediate" event scheduled by components
|
||||
///
|
||||
/// Usually called through "set_state"
|
||||
ScheduledUpdate {
|
||||
height: u32,
|
||||
},
|
||||
|
||||
// Whenever a task is ready (complete) Dioxus produces this "AsyncEvent"
|
||||
//
|
||||
// Async events don't necessarily propagate into a scope being ran. It's up to the event itself
|
||||
@@ -179,10 +172,7 @@ impl VirtualEvent {
|
||||
| VirtualEvent::MouseEvent(_)
|
||||
| VirtualEvent::PointerEvent(_) => true,
|
||||
|
||||
VirtualEvent::GarbageCollection
|
||||
| VirtualEvent::ScheduledUpdate { .. }
|
||||
| VirtualEvent::AsyncEvent { .. }
|
||||
| VirtualEvent::SuspenseEvent { .. } => false,
|
||||
VirtualEvent::AsyncEvent { .. } | VirtualEvent::SuspenseEvent { .. } => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,8 +195,6 @@ impl std::fmt::Debug for VirtualEvent {
|
||||
VirtualEvent::ToggleEvent(_) => "ToggleEvent",
|
||||
VirtualEvent::MouseEvent(_) => "MouseEvent",
|
||||
VirtualEvent::PointerEvent(_) => "PointerEvent",
|
||||
VirtualEvent::GarbageCollection => "GarbageCollection",
|
||||
VirtualEvent::ScheduledUpdate { .. } => "SetStateEvent",
|
||||
VirtualEvent::AsyncEvent { .. } => "AsyncEvent",
|
||||
VirtualEvent::SuspenseEvent { .. } => "SuspenseEvent",
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user