From 418657fd609349323e62d67056dce2583a1a6341 Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Wed, 20 Sep 2023 14:24:28 +0800 Subject: [PATCH] fix(pkg::compiler): set default dummy access model --- packages/compiler/src/builder.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/compiler/src/builder.rs b/packages/compiler/src/builder.rs index a58f0313..484d2572 100644 --- a/packages/compiler/src/builder.rs +++ b/packages/compiler/src/builder.rs @@ -17,13 +17,15 @@ impl TypstCompilerBuilder { #[wasm_bindgen(constructor)] pub fn new() -> ZResult { console_error_panic_hook::set_once(); - Ok(Self { + let mut res = Self { access_model: None, searcher: BrowserFontSearcher::new(), - }) + }; + res.set_dummy_access_model()?; + Ok(res) } - pub async fn set_dummy_access_model(&mut self) -> ZResult<()> { + pub fn set_dummy_access_model(&mut self) -> ZResult<()> { self.access_model = Some(ProxyAccessModel { context: wasm_bindgen::JsValue::UNDEFINED, mtime_fn: js_sys::Function::new_no_args("return new Date(0)"),