fn poll(count: u32, csv_ref: Rc<RefCell<Option<String>>>) -> Result<(), JsValue> {
    if let Some(csv) = csv_ref.borrow().as_ref() {
        let _promise = web_sys::window()
            .unwrap()
            .navigator()
            .clipboard()
            .write_text(csv);
    } else {
        clone!(csv_ref);
        let f: js_sys::Function =
            Closure::once(Box::new(move || poll(count + 1, csv_ref)))
                .into_js_value()
                .unchecked_into();

        web_sys::window()
            .unwrap()
            .set_timeout_with_callback_and_timeout_and_arguments_0(&f, 50)?;
    }
    Ok(())
}
/// This method must be called from an event handler, subject to the browser's
/// restrictions on clipboard access.  See
/// [ws](https://www.w3.org/TR/clipboard-apis/#allow-read-clipboard).
This method must be called from an event handler, subject to the browser's
restrictions on clipboard access.
This method must be called from an event handler subject to the browser ' s restrictions on clipboard access .
fn poll(count: u32, csv_ref: Rc<RefCell<Option<String>>>) -> Result<(), JsValue> {
    if let Some(csv) = csv_ref.borrow().as_ref() {
        let _promise = web_sys::window()
            .unwrap()
            .navigator()
            .clipboard()
            .write_text(csv);
    } else {
        clone!(csv_ref);
        let f: js_sys::Function =
            Closure::once(Box::new(move || poll(count + 1, csv_ref)))
                .into_js_value()
                .unchecked_into();
        web_sys::window()
            .unwrap()
            .set_timeout_with_callback_and_timeout_and_arguments_0(&f, 50)?;
    }
    Ok(())
}
fn poll ( count : u32 , csv_ref : Rc < RefCell < Option < String > > > ) -> Result < ( ) , JsValue > { if let Some ( csv ) = csv_ref . borrow ( ) . as_ref ( ) { let _promise = web_sys :: window ( ) . unwrap ( ) . navigator ( ) . clipboard ( ) . write_text ( csv ) ; } else { clone ! ( csv_ref ) ; let f : js_sys :: Function = Closure :: once ( Box :: new ( move | | poll ( count + 1 , csv_ref ) ) ) . into_js_value ( ) . unchecked_into ( ) ; web_sys :: window ( ) . unwrap ( ) . set_timeout_with_callback_and_timeout_and_arguments_0 ( & f , 50 ) ? ; } Ok ( ( ) ) }
This method must be called from an event handler, subject to the browser's
restrictions on clipboard access.
This method must be called from an event handler subject to the browser ' s restrictions on clipboard access .
count
u32
csv_ref
Rc<RefCell<Option<String>>>
count
u32
csv_ref
Rc<RefCell<Option<String>>>