Get workspace compiling with new event emitters

This commit is contained in:
Mikayla
2023-11-08 19:29:00 -08:00
parent 26fc36ee0e
commit a97c8bf58f
24 changed files with 224 additions and 319 deletions
+1 -1
View File
@@ -201,7 +201,7 @@ pub struct AppContext {
pub(crate) pending_notifications: HashSet<EntityId>,
pub(crate) pending_global_notifications: HashSet<TypeId>,
pub(crate) observers: SubscriberSet<EntityId, Handler>,
// (Entity, Event Type)
// TypeId is the type of the event that the listener callback expects
pub(crate) event_listeners: SubscriberSet<EntityId, (TypeId, Listener)>,
pub(crate) release_listeners: SubscriberSet<EntityId, ReleaseListener>,
pub(crate) global_observers: SubscriberSet<TypeId, Handler>,
-18
View File
@@ -1813,24 +1813,6 @@ impl<'a, V: 'static> ViewContext<'a, V> {
)
}
// Options for simplifying this new event API:
//
// - Make a new stlye of API which does partial application of the arguments to capture
// the types involved e.g.
// `cx.for_entity(handle).subscribe::<ItemEvents>(..)`
//
// - Make it so there are less types:
// - Bail on this idea all together, go back to associated types.
// causes our event enums to be a blob of anything that could happen ever, and
// makes applications have some translation boilerplate
//
// - Move some of the types into the method names,
// `cx.subscribe_model::<_, ItemEvents>(handle)`
//
// - Do something drastic like removing views and models, or removing the multiple
// kind of contexts. (Not going to happen, we already tried this before.)
//
// - Accept it, and use `cx.subscribe::<_, _, ItemEvents>(handle, ...)`
pub fn subscribe<V2, E, Evt>(
&mut self,
entity: &E,