summaryrefslogtreecommitdiffstats
path: root/intl/icu_capi/js/package/lib/ICU4XScriptWithExtensionsBorrowed.js
blob: 073a493f8c562aad7e2070cc803061f89f85aa5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import wasm from "./diplomat-wasm.mjs"
import * as diplomatRuntime from "./diplomat-runtime.js"
import { ICU4XCodePointSetData } from "./ICU4XCodePointSetData.js"
import { ICU4XScriptExtensionsSet } from "./ICU4XScriptExtensionsSet.js"

const ICU4XScriptWithExtensionsBorrowed_box_destroy_registry = new FinalizationRegistry(underlying => {
  wasm.ICU4XScriptWithExtensionsBorrowed_destroy(underlying);
});

export class ICU4XScriptWithExtensionsBorrowed {
  #lifetimeEdges = [];
  constructor(underlying, owned, edges) {
    this.underlying = underlying;
    this.#lifetimeEdges.push(...edges);
    if (owned) {
      ICU4XScriptWithExtensionsBorrowed_box_destroy_registry.register(this, underlying);
    }
  }

  get_script_val(arg_code_point) {
    return wasm.ICU4XScriptWithExtensionsBorrowed_get_script_val(this.underlying, arg_code_point);
  }

  get_script_extensions_val(arg_code_point) {
    return new ICU4XScriptExtensionsSet(wasm.ICU4XScriptWithExtensionsBorrowed_get_script_extensions_val(this.underlying, arg_code_point), true, [this]);
  }

  has_script(arg_code_point, arg_script) {
    return wasm.ICU4XScriptWithExtensionsBorrowed_has_script(this.underlying, arg_code_point, arg_script);
  }

  get_script_extensions_set(arg_script) {
    return new ICU4XCodePointSetData(wasm.ICU4XScriptWithExtensionsBorrowed_get_script_extensions_set(this.underlying, arg_script), true, []);
  }
}