fn poll(
    count: u32,
    mimetype: MimeType,
    js_ref: Rc<RefCell<Option<web_sys::Blob>>>,
) -> Result<(), JsValue> {
    if let Some(js_val) = js_ref.borrow().as_ref() {
        let options = js_sys::Object::new();
        js_sys::Reflect::set(&options, &mimetype.into(), js_val)?;
        let item = ClipboardItem::new(&options);
        let items = [item].iter().collect::<js_sys::Array>();
        let _promise = web_sys::window()
            .unwrap()
            .navigator()
            .clipboard()
            .write(&items.into());
    } else {
        clone!(js_ref);
        let f: js_sys::Function =
            Closure::once(Box::new(move || poll(count + 1, mimetype, js_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,
    mimetype: MimeType,
    js_ref: Rc<RefCell<Option<web_sys::Blob>>>,
) -> Result<(), JsValue> {
    if let Some(js_val) = js_ref.borrow().as_ref() {
        let options = js_sys::Object::new();
        js_sys::Reflect::set(&options, &mimetype.into(), js_val)?;
        let item = ClipboardItem::new(&options);
        let items = [item].iter().collect::<js_sys::Array>();
        let _promise = web_sys::window()
            .unwrap()
            .navigator()
            .clipboard()
            .write(&items.into());
    } else {
        clone!(js_ref);
        let f: js_sys::Function =
            Closure::once(Box::new(move || poll(count + 1, mimetype, js_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 , mimetype : MimeType , js_ref : Rc < RefCell < Option < web_sys :: Blob > > > , ) -> Result < ( ) , JsValue > { if let Some ( js_val ) = js_ref . borrow ( ) . as_ref ( ) { let options = js_sys :: Object :: new ( ) ; js_sys :: Reflect :: set ( & options , & mimetype . into ( ) , js_val ) ? ; let item = ClipboardItem :: new ( & options ) ; let items = [ item ] . iter ( ) . collect :: < js_sys :: Array > ( ) ; let _promise = web_sys :: window ( ) . unwrap ( ) . navigator ( ) . clipboard ( ) . write ( & items . into ( ) ) ; } else { clone ! ( js_ref ) ; let f : js_sys :: Function = Closure :: once ( Box :: new ( move | | poll ( count + 1 , mimetype , js_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
mimetype
MimeType
js_ref
Rc<RefCell<Option<web_sys::Blob>>>
count
u32
mimetype
MimeType
js_ref
Rc<RefCell<Option<web_sys::Blob>>>