1
0
Fork 0
firefox/intl/icu_capi/bindings/js/CodePointRangeIterator.mjs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

28 lines
958 B
JavaScript

import wasm from "./diplomat-wasm.mjs"
import * as diplomatRuntime from "./diplomat-runtime.mjs"
import { CodePointRangeIteratorResult } from "./CodePointRangeIteratorResult.mjs"
const CodePointRangeIterator_box_destroy_registry = new FinalizationRegistry(underlying => {
wasm.CodePointRangeIterator_destroy(underlying);
});
export class CodePointRangeIterator {
#lifetimeEdges = [];
constructor(underlying, owned, edges) {
this.underlying = underlying;
this.#lifetimeEdges.push(...edges);
if (owned) {
CodePointRangeIterator_box_destroy_registry.register(this, underlying);
}
}
next() {
return (() => {
const diplomat_receive_buffer = wasm.diplomat_alloc(9, 4);
wasm.CodePointRangeIterator_next(diplomat_receive_buffer, this.underlying);
const out = new CodePointRangeIteratorResult(diplomat_receive_buffer);
wasm.diplomat_free(diplomat_receive_buffer, 9, 4);
return out;
})();
}
}