/// Get the underlying `Table` for this viewer.
///
/// # Arguments
/// - `wait_for_table` whether to wait for `load()` to be called, or fail
///   immediately if `load()` has not yet been called.  
Get the underlying `Table` for this viewer.
Get the underlying ` Table ` for this viewer .
pub fn js_get_table(&self, wait_for_table: bool) -> js_sys::Promise {
        let session = self.session.clone();
        future_to_promise(async move {
            match session.js_get_table() {
                Some(table) => Ok(table),
                None if !wait_for_table => Err(JsValue::from("No table set")),
                None => {
                    let (sender, receiver) = channel::<()>();
                    let sender = RefCell::new(Some(sender));
                    let _sub = session.on_table_loaded.add_listener(move |x| {
                        sender.borrow_mut().take().unwrap().send(x).unwrap()
                    });
                    receiver.await.into_jserror()?;
                    session.js_get_table().ok_or_else(|| "No table set".into())
                }
            }
        })
    }
pub fn js_get_table ( & self , wait_for_table : bool ) -> js_sys :: Promise { let session = self . session . clone ( ) ; future_to_promise ( async move { match session . js_get_table ( ) { Some ( table ) => Ok ( table ) , None if ! wait_for_table => Err ( JsValue :: from ( " " ) ) , None => { let ( sender , receiver ) = channel :: < ( ) > ( ) ; let sender = RefCell :: new ( Some ( sender ) ) ; let _sub = session . on_table_loaded . add_listener ( move | x | { sender . borrow_mut ( ) . take ( ) . unwrap ( ) . send ( x ) . unwrap ( ) } ) ; receiver . await . into_jserror ( ) ? ; session . js_get_table ( ) . ok_or_else ( | | " " . into ( ) ) } } } ) }
Get the underlying `Table` for this viewer.
Get the underlying ` Table ` for this viewer .
&self
wait_for_table
bool
whether to wait for `load()` to be called, or fail
immediately if `load()` has not yet been called.
whether to wait for ` load () ` to be called or fail immediately if ` load () ` has not yet been called .