workflow_nw/ipc/
target.rs1use crate::ipc::imports::*;
2
3#[derive(Clone, Debug)]
4pub struct IpcTarget {
5 target: Rc<JsValue>,
6}
7
8unsafe impl Send for IpcTarget {}
9unsafe impl Sync for IpcTarget {}
10
11impl IpcTarget {
12 pub fn new(target: &JsValue) -> IpcTarget {
13 IpcTarget {
14 target: Rc::new(target.clone()),
15 }
16 }
17}
18
19impl AsRef<JsValue> for IpcTarget {
20 fn as_ref(&self) -> &JsValue {
21 &self.target
22 }
23}
24
25impl From<nw_sys::Window> for IpcTarget {
26 fn from(window: nw_sys::Window) -> IpcTarget {
27 IpcTarget::new(window.window().as_ref())
28 }
29}
30
31impl From<Arc<nw_sys::Window>> for IpcTarget {
32 fn from(window: Arc<nw_sys::Window>) -> IpcTarget {
33 IpcTarget::new(window.window().as_ref())
34 }
35}