Context implementation

This commit is contained in:
2026-01-28 23:50:08 +01:00
parent 93ba2f4a78
commit 0cf0eb42fc
3 changed files with 19 additions and 1 deletions
+10 -1
View File
@@ -5,7 +5,7 @@ use std::{
};
use crate::{
engine::CommandExecutor,
engine::{Command, CommandExecutor},
render::DrawContext,
state::{use_effect, HookDependency},
View, ViewWrapper,
@@ -175,6 +175,15 @@ impl Context {
pub fn get_executor(self: &Arc<Self>) -> Arc<dyn CommandExecutor> {
self.executor.clone()
}
pub fn execute<T: Command + 'static>(self: &Arc<Self>, command: T) -> crate::Result<()> {
self.executor
.execute_command(&(Arc::new(command) as Arc<dyn Command>))
}
pub fn stop(self: &Arc<Self>) -> crate::Result<()> {
self.execute(crate::engine::commands::Stop)
}
}
impl Scope {