What happens when an async function is imported?

Abierto
#64 9 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
javascript, wasm
Área
web-dev

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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?

Lenguaje dominante
WebAssembly
Estrellas
458
Forks
40
Merge medio
10 d 37 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de WebAssembly/esm-integration

Todos los issues de WebAssembly/esm-integration

Issues similares

Más issues de Web Dev

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.