|
@@ -7,7 +7,7 @@ use crate::{
|
|
innerlude::{ErrorBoundary, Scheduler, SchedulerMsg},
|
|
innerlude::{ErrorBoundary, Scheduler, SchedulerMsg},
|
|
lazynodes::LazyNodes,
|
|
lazynodes::LazyNodes,
|
|
nodes::{ComponentReturn, IntoAttributeValue, IntoDynNode, RenderReturn},
|
|
nodes::{ComponentReturn, IntoAttributeValue, IntoDynNode, RenderReturn},
|
|
- AnyValue, Attribute, AttributeValue, Element, Event, Properties, TaskId,
|
|
|
|
|
|
+ AnyValue, Attribute, AttributeValue, Element, Event, EventReturn, Properties, TaskId,
|
|
};
|
|
};
|
|
use bumpalo::{boxed::Box as BumpBox, Bump};
|
|
use bumpalo::{boxed::Box as BumpBox, Bump};
|
|
use bumpslab::{BumpSlab, Slot};
|
|
use bumpslab::{BumpSlab, Slot};
|
|
@@ -581,9 +581,9 @@ impl<'src> ScopeState {
|
|
/// Create a new [`AttributeValue`] with the listener variant from a callback
|
|
/// Create a new [`AttributeValue`] with the listener variant from a callback
|
|
///
|
|
///
|
|
/// The callback must be confined to the lifetime of the ScopeState
|
|
/// The callback must be confined to the lifetime of the ScopeState
|
|
- pub fn listener<T: 'static>(
|
|
|
|
|
|
+ pub fn listener<T: 'static, P, E: EventReturn<P>>(
|
|
&'src self,
|
|
&'src self,
|
|
- mut callback: impl FnMut(Event<T>) + 'src,
|
|
|
|
|
|
+ mut callback: impl FnMut(Event<T>) -> E + 'src,
|
|
) -> AttributeValue<'src> {
|
|
) -> AttributeValue<'src> {
|
|
// safety: there's no other way to create a dynamicly-dispatched bump box other than alloc + from-raw
|
|
// safety: there's no other way to create a dynamicly-dispatched bump box other than alloc + from-raw
|
|
// This is the suggested way to build a bumpbox
|
|
// This is the suggested way to build a bumpbox
|
|
@@ -596,6 +596,7 @@ impl<'src> ScopeState {
|
|
propagates: event.propagates,
|
|
propagates: event.propagates,
|
|
data,
|
|
data,
|
|
})
|
|
})
|
|
|
|
+ .spawn(self);
|
|
}
|
|
}
|
|
}))
|
|
}))
|
|
};
|
|
};
|