pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://developer.mozilla.org/de/docs/WebAssembly/Reference/JavaScript_interface/JSTag_static

"font/woff2" crossorigen="anonymous" fetchpriority="low" />

Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

WebAssembly.JSTag

Die JSTag schreibgeschützte statische Eigenschaft der WebAssembly Schnittstelle ist ein eingebautes WebAssembly.Tag und repräsentiert Ausnahmen, die im JavaScript-Host ausgelöst werden — sie ermöglicht, dass Ausnahmen, die in JavaScript ausgelöst werden, von innerhalb eines Wasm-Moduls behandelt werden können.

Probieren Sie es aus

(module
  (tag $js_tag (import "env" "js_tag") (param externref))
  (import "env" "do_work" (func $do_work))
  (import "env" "log" (func $log (param externref)))

  (func $try_and_catch
    (block $handler (result externref)
      (try_table (catch $js_tag $handler)
        ;; Call a JS function that throws
        (call $do_work)
      )
      (return)
    )
    ;; The JS Error object is on the stack as an externref
    ;; Pass it back to JS for logging
    (call $log)
  )

  (export "try_and_catch" (func $try_and_catch))
)
async function run() {
  const { instance } = await WebAssembly.instantiateStreaming(
    fetch("{%wasm-url%}"),
    {
      env: {
        js_tag: WebAssembly.JSTag,
        // This JS function throws, which Wasm will catch via JSTag
        do_work: () => {
          throw new Error("An exception was thrown in JS");
        },
        log: (error) => {
          // errRef is the JS Error object passed back as an externref
          console.log(error.message);
        },
      },
    },
  );

  instance.exports.try_and_catch();
}

run();

Wert

Ein WebAssembly.Tag mit einem Typ von externref ((tag (param externref))).

Spezifikationen

Spezifikation
WebAssembly JavaScript Interface
# dom-webassembly-jstag

Browser-Kompatibilität

Siehe auch

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy