summaryrefslogtreecommitdiffstats
path: root/intl/icu_capi/js/package/lib/ICU4XLocaleFallbackConfig.js
blob: f327a084beea14facd8b49b2731e37ee09c86719 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import wasm from "./diplomat-wasm.mjs"
import * as diplomatRuntime from "./diplomat-runtime.js"
import { ICU4XLocaleFallbackPriority_js_to_rust, ICU4XLocaleFallbackPriority_rust_to_js } from "./ICU4XLocaleFallbackPriority.js"
import { ICU4XLocaleFallbackSupplement_js_to_rust, ICU4XLocaleFallbackSupplement_rust_to_js } from "./ICU4XLocaleFallbackSupplement.js"

export class ICU4XLocaleFallbackConfig {
  constructor(underlying, edges_a) {
    this.priority = ICU4XLocaleFallbackPriority_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, underlying)];
    this.extension_key = (() => {
      const [ptr, size] = new Uint32Array(wasm.memory.buffer, underlying + 4, 2);
      return diplomatRuntime.readString(wasm, ptr, size);
    })();
    this.fallback_supplement = ICU4XLocaleFallbackSupplement_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, underlying + 12)];
  }
}