What happens when an async function is imported?

Aperta
#64 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
javascript, wasm
Ambito
web-dev

Direzione di ricerca

Start with the function import example in main.wat and counter.js, where getCount is changed to an async function. Read the linked WebAssembly JavaScript Promise Integration proposal and the existing issue discussion to determine whether async imports should be supported or rejected more clearly. Done means the expected runtime behavior and relationship to that proposal are decided.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

For example, if we modify the function import example and make getCount async.

;; main.wat --> main.wasm
(module
  (import "./counter.js" "getCount" (func $getCount (func (result i32))))
)
// counter.js
async function getCount() {
    const response = await fetch('//api/get-count');
    ...
    return count;
}
export {getCount};

Given existing behaviour, it would crash at runtime. But should we do better?

Should this rely on or interact with https://github.com/WebAssembly/js-promise-integration?

Lingua principale
WebAssembly
Stelle
458
Fork
40
Merge medio
10g 37m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WebAssembly/esm-integration

Tutte le issue di WebAssembly/esm-integration

Issue simili

Altre issue su Web Dev

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.