This commit is contained in:
Mike Farrell
2024-10-10 11:52:33 -07:00
parent c017847d7b
commit b11e8af9c7
2 changed files with 22 additions and 24 deletions

View File

@ -1,4 +1,4 @@
import * as EngineUtils from './engine-utils/engine.js' import EngineUtils from './engine-utils/engine.js'
type KCEngineUtilsEvaluatePath = { type KCEngineUtilsEvaluatePath = {
(sketch: string, t: number): string (sketch: string, t: number): string
@ -8,19 +8,14 @@ let kcEngineUtilsEvaluatePath: KCEngineUtilsEvaluatePath
export async function init() { export async function init() {
return await new Promise((resolve, reject) => { return await new Promise((resolve, reject) => {
try { try {
kcEngineUtilsEvaluatePath = (s: string, t: number) => { EngineUtils().then((module) => {
return 'it works' kcEngineUtilsEvaluatePath = module.cwrap(
} 'kcEngineCalcPathEndpoint',
'string',
['string', 'number']
)
resolve(true) resolve(true)
})
// EngineUtils.Module().then(() => {
// kcEngineUtilsEvaluatePath = EngineUtils.Module.cwrap(
// 'kcEngineCalcPathEndpoint',
// 'string',
// ['string', 'number']
// )
// resolve(true)
// })
} catch (e) { } catch (e) {
reject(e) reject(e)
} }

View File

@ -1548,16 +1548,19 @@ pub(crate) async fn inner_arc(
}) })
})?; })?;
//let str_result: Rc<RefCell<Option<String>>> = Rc::new(RefCell::new(None)); let promise = get_true_path_end_pos(sketch_json_value.into()).map_err(|e| {
//let str_result0 = Rc::clone(&str_result); KclError::Internal(KclErrorDetails {
//wasm_bindgen_futures::spawn_local(async move { message: format!("{:?}", e),
let promise = get_true_path_end_pos(sketch_json_value.into()).unwrap(); source_ranges: vec![args.source_range],
let result = crate::wasm::JsFuture::from(promise).await.unwrap(); })
web_sys::console::log_1(&format!("Inside here {result:?}").into()); })?;
//*str_result0.borrow_mut() = Some(result); let result = crate::wasm::JsFuture::from(promise).await.map_err(|e| {
//}); KclError::Internal(KclErrorDetails {
message: format!("{:?}", e),
//web_sys::console::log_1(&format!("Did this work? {str_result:?}").into()); source_ranges: vec![args.source_range],
})
})?;
web_sys::console::log_1(&format!("Testing here {result:?}").into());
} }
//duplicating engine logic to make sure this is _exactly_ what engine is doing - mike //duplicating engine logic to make sure this is _exactly_ what engine is doing - mike