summaryrefslogtreecommitdiffstats
path: root/intl/icu_capi/js/package/lib/ICU4XGraphemeClusterBreakIteratorUtf16.js
blob: cc997daa057eff0dffb9ed18de04e3c82983a2a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import wasm from "./diplomat-wasm.mjs"
import * as diplomatRuntime from "./diplomat-runtime.js"

const ICU4XGraphemeClusterBreakIteratorUtf16_box_destroy_registry = new FinalizationRegistry(underlying => {
  wasm.ICU4XGraphemeClusterBreakIteratorUtf16_destroy(underlying);
});

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

  next() {
    return wasm.ICU4XGraphemeClusterBreakIteratorUtf16_next(this.underlying);
  }
}