Skip to content

Commit

Permalink
Deploying to gh-pages from @ bbf5061 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Laux committed May 7, 2024
1 parent 46b677d commit 39d7488
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pkg/message_parser_wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
export function parse_text(s: string, enable_markdown: boolean): any;
/**
* parses text to json AST (text elements and labled links, to replicate current desktop implementation)
* parses text to json AST (text elements and labeled links, to replicate current desktop implementation)
* @param {string} s
* @returns {any}
*/
Expand Down
28 changes: 14 additions & 14 deletions pkg/message_parser_wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ function takeObject(idx) {
return ret;
}

function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];

heap[idx] = obj;
return idx;
}

const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );

if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
Expand All @@ -38,15 +47,6 @@ function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}

function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];

heap[idx] = obj;
return idx;
}

function debugString(val) {
// primitive types
const type = typeof val;
Expand Down Expand Up @@ -189,7 +189,7 @@ export function parse_text(s, enable_markdown) {
}

/**
* parses text to json AST (text elements and labled links, to replicate current desktop implementation)
* parses text to json AST (text elements and labeled links, to replicate current desktop implementation)
* @param {string} s
* @returns {any}
*/
Expand Down Expand Up @@ -237,14 +237,14 @@ function __wbg_get_imports() {
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
const ret = getObject(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
imports.wbg.__wbg_set_bd72c078edfa51ad = function(arg0, arg1, arg2) {
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
};
Expand Down
Binary file modified pkg/message_parser_wasm_bg.wasm
Binary file not shown.

0 comments on commit 39d7488

Please sign in to comment.