mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 10:01:39 -05:00
Add error handling to undo excmd and remove session limit.
This commit is contained in:
parent
7bae3e77ae
commit
e0fdeeb54e
1 changed files with 3 additions and 1 deletions
|
@ -2390,7 +2390,7 @@ export async function tabclosealltoleft() {
|
||||||
//#background
|
//#background
|
||||||
export async function undo(item = "recent"): Promise<Number> {
|
export async function undo(item = "recent"): Promise<Number> {
|
||||||
const current_win_id: number = (await browser.windows.getCurrent()).id
|
const current_win_id: number = (await browser.windows.getCurrent()).id
|
||||||
const sessions = await browser.sessions.getRecentlyClosed({ maxResults: 10 })
|
const sessions = await browser.sessions.getRecentlyClosed()
|
||||||
|
|
||||||
if (item === "tab") {
|
if (item === "tab") {
|
||||||
const lastSession = sessions.find(s => {if (s.tab) return true})
|
const lastSession = sessions.find(s => {if (s.tab) return true})
|
||||||
|
@ -2425,6 +2425,8 @@ export async function undo(item = "recent"): Promise<Number> {
|
||||||
return lastSession.window.id
|
return lastSession.window.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new Error(`[undo] Invalid argument: ${item}. Must be one of "tab", "window", "recent"`)
|
||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue