wasm: one IPN per runtime with an explicit readiness handshake #20
@@ -625,6 +625,11 @@ func (i *jsIPN) logout() {
|
||||
}()
|
||||
}
|
||||
|
||||
// shutdown tears down the backend and lets main return, which exits the whole
|
||||
// Go runtime. Callers should await the runtime's exit rather than the promise
|
||||
// returned here: closing shutdownCh races with makePromise resolving, so the
|
||||
// promise may never settle. There is exactly one IPN per runtime, so the once
|
||||
// and the channel belong to the same instance and a second call is a no-op.
|
||||
func (i *jsIPN) shutdown() js.Value {
|
||||
return makePromise(func() (any, error) {
|
||||
i.shutdownOnce.Do(func() {
|
||||
|
||||
Reference in New Issue
Block a user