Added ExtensionContext #26

This commit is contained in:
2025-08-04 04:45:55 -05:00
parent 14602f95c8
commit 48397c06fa
5 changed files with 68 additions and 22 deletions
+5 -2
View File
@@ -33,6 +33,7 @@ use std::sync::{Arc, Mutex};
use crate::{
extensions::{Extension, Handler},
prelude::ExtensionContext,
render_scope::RenderScope,
widget::{BoxedElement, DynWidget, Element, StaticWidget, Widget, WidgetLoad},
};
@@ -158,8 +159,10 @@ impl Screen {
///
/// This method blocks and repeatedly renders the screen at a fixed interval.
pub fn run(self: &Arc<Self>) -> std::io::Result<()> {
let ctx = ExtensionContext::new(self.clone());
for ext in self.extensions.lock().unwrap().iter() {
ext.lock().unwrap().init(self.clone());
ext.lock().unwrap().init(&ctx);
}
utils::hide_cursor()?;
@@ -230,7 +233,7 @@ impl Screen {
utils::clear().unwrap();
for ext in self.extensions.lock().unwrap().iter() {
ext.lock().unwrap().on_close(self.clone());
ext.lock().unwrap().on_close();
}
}
}