Feat: yeet, synthetic somewhat wired up

This commit is contained in:
Jonathan Kelley committed 2021-03-04 18:40:05 -05:00
1 parent 3087813570
commit d9598066c2
7 files changed
+79 -47

No files matched your search

+7 -7
View File
@@ -339,18 +339,18 @@ where
/// })
/// .finish();
/// ```
#[inline]
pub fn on(mut self, event: &'static str, callback: impl Fn(VirtualEvent) + 'a) -> Self {
// todo:
// increment listner id from nodectx ref
// add listener attrs here instead of later?
self.listeners.push(Listener {
let listener = Listener {
event,
callback: self.ctx.bump.alloc(callback),
id: *self.ctx.idx.borrow(),
scope: self.ctx.scope,
});
};
self.add_listener(listener)
}
pub fn add_listener(mut self, listener: Listener<'a>) -> Self {
self.listeners.push(listener);
// bump the context id forward
*self.ctx.idx.borrow_mut() += 1;