mirror of
https://github.com/loro-dev/loro.git
synced 2025-02-06 12:25:03 +00:00
0cd38270f9
bench(wasm): add snapshot bench
38 lines
723 B
TypeScript
38 lines
723 B
TypeScript
import initWasm, {
|
|
ContainerID,
|
|
initSync,
|
|
Loro,
|
|
LoroList,
|
|
LoroMap,
|
|
LoroText,
|
|
PrelimList,
|
|
PrelimMap,
|
|
PrelimText,
|
|
setPanicHook,
|
|
} from "./pkg/loro_wasm.js";
|
|
import { InitInput, InitOutput } from "./pkg/loro_wasm.d.ts";
|
|
|
|
export {
|
|
ContainerID,
|
|
initSync,
|
|
Loro,
|
|
LoroList,
|
|
LoroMap,
|
|
LoroText,
|
|
PrelimList,
|
|
PrelimMap,
|
|
PrelimText,
|
|
};
|
|
|
|
// Extend the interfaces here, to provide richer type information
|
|
declare module "./pkg/loro_wasm.js" {
|
|
interface Loro {
|
|
exportUpdates(version?: Uint8Array): Uint8Array;
|
|
}
|
|
}
|
|
|
|
export async function init(module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput> {
|
|
const out = await initWasm(module_or_path);
|
|
setPanicHook();
|
|
return out
|
|
}
|