Skip to content

Commit

Permalink
feat(core): properly implement converting blob
Browse files Browse the repository at this point in the history
  • Loading branch information
ermshiperete committed Dec 16, 2024
1 parent 193dd77 commit 06a8c7a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions core/src/wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,9 @@ km_core_keyboard_load_from_blob_wasm(
std::string kb_name,
const emscripten::val& blob_val
) {
std::vector<uint8_t> blob;
std::vector<uint8_t> blob = emscripten::convertJSArrayToNumberVector<uint8_t>(blob_val);
km_core_keyboard* keyboard_ptr = nullptr;

const auto length = blob_val["length"].as<unsigned>();
blob.resize(length);

emscripten::val memoryView{emscripten::typed_memory_view(length, blob.data())};
memoryView.call<void>("set", blob_val);
km_core_status retVal = ::keyboard_load_from_blob_internal(kb_name.c_str(), blob, &keyboard_ptr);
return new CoreReturn<km_core_keyboard>(retVal, keyboard_ptr);
}
Expand Down

0 comments on commit 06a8c7a

Please sign in to comment.