/// Configures this [PdfiumRenderWasmState] with bindings to emscripten-exposed Pdfium functions
/// in the given Javascript Object.
Configures this [PdfiumRenderWasmState] with bindings to emscripten-exposed Pdfium functions
in the given Javascript Object.
Configures this [ PdfiumRenderWasmState ] with bindings to emscripten - exposed Pdfium functions in the given Javascript Object .
fn bind_to_pdfium(&mut self, module: Object, debug: bool) -> Result<(), &str> {
        self.malloc_js_fn = Some(Function::from(
            Reflect::get(&module, &JsValue::from("_malloc"))
                .map_err(|_| "Module._malloc() not defined")?,
        ));
        self.free_js_fn = Some(Function::from(
            Reflect::get(&module, &JsValue::from("_free"))
                .map_err(|_| "Module._free() not defined")?,
        ));
        self.call_js_fn = Some(Function::from(
            Reflect::get(&module, &JsValue::from("ccall"))
                .map_err(|_| "Module.ccall() not defined")?,
        ));
        // We don't define a fixed binding to it, but check now that the Module.HEAPU8 accessor works.
        if Reflect::get(&module, &JsValue::from("HEAPU8")).is_err() {
            return Err("Module.HEAPU8[] not defined");
        }
        self.pdfium_wasm_module = Some(module);
        self.debug = debug;
        Ok(())
    }
fn bind_to_pdfium ( & mut self , module : Object , debug : bool ) -> Result < ( ) , & str > { self . malloc_js_fn = Some ( Function :: from ( Reflect :: get ( & module , & JsValue :: from ( " " ) ) . map_err ( | _ | " " ) ? , ) ) ; self . free_js_fn = Some ( Function :: from ( Reflect :: get ( & module , & JsValue :: from ( " " ) ) . map_err ( | _ | " " ) ? , ) ) ; self . call_js_fn = Some ( Function :: from ( Reflect :: get ( & module , & JsValue :: from ( " " ) ) . map_err ( | _ | " " ) ? , ) ) ; // We don't define a fixed binding to it, but check now that the Module.HEAPU8 accessor works. if Reflect :: get ( & module , & JsValue :: from ( " " ) ) . is_err ( ) { return Err ( " " ) ; } self . pdfium_wasm_module = Some ( module ) ; self . debug = debug ; Ok ( ( ) ) }
Configures this [PdfiumRenderWasmState] with bindings to emscripten-exposed Pdfium functions
in the given Javascript Object.
Configures this [ PdfiumRenderWasmState ] with bindings to emscripten - exposed Pdfium functions in the given Javascript Object .
&mut self
module
Object
debug
bool