summaryrefslogtreecommitdiffstats
path: root/intl/icu_capi/js/package/lib/ICU4XLogger.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /intl/icu_capi/js/package/lib/ICU4XLogger.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'intl/icu_capi/js/package/lib/ICU4XLogger.js')
-rw-r--r--intl/icu_capi/js/package/lib/ICU4XLogger.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/intl/icu_capi/js/package/lib/ICU4XLogger.js b/intl/icu_capi/js/package/lib/ICU4XLogger.js
new file mode 100644
index 0000000000..e696f7fd9b
--- /dev/null
+++ b/intl/icu_capi/js/package/lib/ICU4XLogger.js
@@ -0,0 +1,25 @@
+import wasm from "./diplomat-wasm.mjs"
+import * as diplomatRuntime from "./diplomat-runtime.js"
+
+const ICU4XLogger_box_destroy_registry = new FinalizationRegistry(underlying => {
+ wasm.ICU4XLogger_destroy(underlying);
+});
+
+export class ICU4XLogger {
+ #lifetimeEdges = [];
+ constructor(underlying, owned, edges) {
+ this.underlying = underlying;
+ this.#lifetimeEdges.push(...edges);
+ if (owned) {
+ ICU4XLogger_box_destroy_registry.register(this, underlying);
+ }
+ }
+
+ static init_simple_logger() {
+ return wasm.ICU4XLogger_init_simple_logger();
+ }
+
+ static init_console_logger() {
+ return wasm.ICU4XLogger_init_console_logger();
+ }
+}