mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
fix(dash): [PKG-DASH-CLEANUP-01] preserve first cleanup exception
This commit is contained in:
1 parent
1c522f181b
commit
25faf88e80
23 files changed
+49546
-147
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import type { Cleanup, DisplayConfig, Label, MenuHost, MenuModel, SelectorItem, Valid } from './types'
|
||||
import { runCleanups } from './cleanup'
|
||||
|
||||
export function createMenu<Item extends SelectorItem>(art: MenuHost, name: string, icon: string) {
|
||||
let current: object | undefined
|
||||
@@ -18,17 +19,7 @@ export function createMenu<Item extends SelectorItem>(art: MenuHost, name: strin
|
||||
|
||||
function clear(): void {
|
||||
current = undefined
|
||||
let failure: unknown
|
||||
for (const [surface, callback] of [...owned]) {
|
||||
try {
|
||||
remove(surface, callback)
|
||||
}
|
||||
catch (error) {
|
||||
failure ||= error
|
||||
}
|
||||
}
|
||||
if (failure)
|
||||
throw failure
|
||||
runCleanups([...owned].map(([surface, callback]) => () => remove(surface, callback)))
|
||||
}
|
||||
|
||||
function update(config: DisplayConfig, model: MenuModel<Item> | null, active: Valid): void {
|
||||
|
||||
Reference in new issue
Block a user