rust-windowing / rust-windowing/winit

[Feature Request]: Ability to make event_loop async to satisfy WGPU on WASM in Resumed Event

Open
#3,560 17 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DS - web
Dominant language
Rust
Stars
6.2k
Forks
1.3k
Avg merge
2d 19h
Merged PRs (30d)
9

Description

I would like to request the ability to .await code within the event loop, such as inside the Resumed event. This'll allow initializing libraries such as WGPU which require async code to be ran on platforms without thread blocking such as WASM. Right now the only way to run async functions without blocking is to do it outside of the event loop and to keep asyncing everything up to the original function that the program starts at (with wasm_bindgen)

I'm trying to support 3 platforms. The platforms are Desktop, Android, and Web Browser. I have the first two platforms down which both wait for the Resumed event to be called before creating the window. This is the only thing preventing me from supporting the web browser

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading winit's event-loop and Resumed-event APIs, then compare how the Desktop, Android, and Web Browser paths handle initialization. Define how async work could be awaited in Resumed without blocking WASM, and verify that the resulting approach supports the three platforms described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
desktop, mobile, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.