Manual polling of the event loop

Open
#4,401 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
go
Domain
desktop

Research direction

Start by tracing the existing app.run() event-loop entry point and review the linked webview/webview proposal. Define what app.step() must do for a caller-owned main-thread loop, then verify that an external loop can process library events without app.run() blocking.

Written by the indexing model from the issue text.

Description

Enhancement Linux MacOS P2 stale TODO v3 Windows
Is your feature request related to a problem? Please describe.

I'm working with a library that requires managing its own event loop on the main thread. Currently, calling app.run() starts the Wails' event loop but blocks the main thread entirely.

Describe the solution you'd like

I want to implement my own loop where I can process my library's events and call app.step() inside that loop to run one iteration of Wails' event loop.

func main() {
    for {
        // do stuff
        // app.step()
    }
}
Describe alternatives you've considered

Apparently Tauri has a function run_on_main_thread that you register on the application's startup and will execute whatever lambda passed in argument on the main thread. I don't know how it works and find it less ergonomic than manually calling app.step()

Additional context

My approach is inspired by an abandoned proposal from this library: https://github.com/webview/webview/pull/735

Dominant language
Go
Stars
36.3k
Forks
1.9k
Avg merge
2d 11h
Merged PRs (30d)
33

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.

More from wailsapp/wails

All issues in wailsapp/wails

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.