Debian Codegraph @

intl/icu_capi/bindings/js/ICU4XScriptExtensionsSet.mjs

raw
1 import wasm from "./diplomat-wasm.mjs"
2 import * as diplomatRuntime from "./diplomat-runtime.mjs"
3
4 const ICU4XScriptExtensionsSet_box_destroy_registry = new FinalizationRegistry(underlying => {
5 wasm.ICU4XScriptExtensionsSet_destroy(underlying);
6 });
7
8 export class ICU4XScriptExtensionsSet {
9 #lifetimeEdges = [];
10 constructor(underlying, owned, edges) {
11 this.underlying = underlying;
12 this.#lifetimeEdges.push(...edges);
13 if (owned) {
14 ICU4XScriptExtensionsSet_box_destroy_registry.register(this, underlying);
15 }
16 }
17
18 contains(arg_script) {
19 return wasm.ICU4XScriptExtensionsSet_contains(this.underlying, arg_script);
20 }
21
22 count() {
23 return wasm.ICU4XScriptExtensionsSet_count(this.underlying);
24 }
25
26 script_at(arg_index) {
27 return (() => {
28 const diplomat_receive_buffer = wasm.diplomat_alloc(3, 2);
29 wasm.ICU4XScriptExtensionsSet_script_at(diplomat_receive_buffer, this.underlying, arg_index);
30 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 2);
31 if (!is_ok) {
32 wasm.diplomat_free(diplomat_receive_buffer, 3, 2);
33 return;
34 }
35 const value = (new Uint16Array(wasm.memory.buffer, diplomat_receive_buffer, 1))[0];
36 wasm.diplomat_free(diplomat_receive_buffer, 3, 2);
37 return value;
38 })();
39 }
40 }