golang.design/x/mainthread (go): Package mainthread offers facilities to schedule functions on the main thread. To use this package properly, one must call `mainthread.Init` from the main package. For example:  If the given function triggers a panic, and called via `mainthread.Call`, then the panic will be propagated to the same goroutine. One can capture that panic, when possible:  If the given function triggers a panic, and called via `mainthread.Go`, then the panic will be cached internally, until a call to the `Error()` method:  Note that a panic happens before `mainthread.Error()` returning the panicked error. If one needs to guarantee `mainthread.Error()` indeed captured the panic, a dummy function can be used as synchornization:  It is possible to cache up to a maximum of 42 panicked errors. More errors are ignored.
Keywords: go|golang|mainthread