fix: support concurrent game windows and prepare beta12 GitHub releases
This commit is contained in:
1 parent
91f483b960
commit
1cf67602d8
33 files changed
+681
-293
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { reactive } from 'vue'
|
||||
|
||||
const pending = reactive(new Map<string, Promise<unknown>>())
|
||||
|
||||
export function isInstanceLaunching(instanceId: string) {
|
||||
return pending.has(instanceId)
|
||||
}
|
||||
|
||||
/** Coalesce repeated clicks for one launch without blocking other instances. */
|
||||
export function launchOnce<T>(instanceId: string, launch: () => Promise<T>): Promise<T> {
|
||||
const existing = pending.get(instanceId)
|
||||
if (existing) return existing as Promise<T>
|
||||
const task = Promise.resolve()
|
||||
.then(launch)
|
||||
.finally(() => {
|
||||
pending.delete(instanceId)
|
||||
})
|
||||
pending.set(instanceId, task)
|
||||
return task
|
||||
}
|
||||
Reference in new issue
Block a user