From 06a8c7a867aea88df187f2407d4828f6e0771509 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Mon, 16 Dec 2024 17:22:11 +0100 Subject: [PATCH] feat(core): properly implement converting blob --- core/src/wasm.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core/src/wasm.cpp b/core/src/wasm.cpp index f11158470e2..a0dc5c1f790 100644 --- a/core/src/wasm.cpp +++ b/core/src/wasm.cpp @@ -57,14 +57,9 @@ km_core_keyboard_load_from_blob_wasm( std::string kb_name, const emscripten::val& blob_val ) { - std::vector blob; + std::vector blob = emscripten::convertJSArrayToNumberVector(blob_val); km_core_keyboard* keyboard_ptr = nullptr; - const auto length = blob_val["length"].as(); - blob.resize(length); - - emscripten::val memoryView{emscripten::typed_memory_view(length, blob.data())}; - memoryView.call("set", blob_val); km_core_status retVal = ::keyboard_load_from_blob_internal(kb_name.c_str(), blob, &keyboard_ptr); return new CoreReturn(retVal, keyboard_ptr); }