WIP - Allow RpcClient to register handlers for incoming messages

This commit is contained in:
Max Brunsfeld
2021-06-15 17:22:48 -07:00
parent d3a3ad2820
commit 8b66e0aa7e
6 changed files with 190 additions and 29 deletions
+9 -1
View File
@@ -1340,10 +1340,18 @@ impl MutableAppContext {
Fut: 'static + Future<Output = T>,
T: 'static,
{
let cx = AsyncAppContext(self.weak_self.as_ref().unwrap().upgrade().unwrap());
let cx = self.to_async();
self.foreground.spawn(f(cx))
}
pub fn to_async(&self) -> AsyncAppContext {
AsyncAppContext(self.weak_self.as_ref().unwrap().upgrade().unwrap())
}
pub fn to_background(&self) -> BackgroundAppContext {
//
}
pub fn write_to_clipboard(&self, item: ClipboardItem) {
self.platform.write_to_clipboard(item);
}