Add reload commands

I also made getnexttabs asynchronous, because I suspect it will have to
be, eventually.
This commit is contained in:
Oliver Blanthorn 2017-09-30 17:58:56 +01:00
parent b468747333
commit 861a0aae03
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 15 additions and 2 deletions

View file

@ -43,7 +43,7 @@ namespace ExCmds {
// Tab functions // Tab functions
// TODO: to be implemented! // TODO: to be implemented!
export function getnexttabs(tabid: number, n: number){ export async function getnexttabs(tabid: number, n: number){
return [tabid] return [tabid]
} }
@ -61,9 +61,20 @@ namespace ExCmds {
export async function tabclose(n = 1){ export async function tabclose(n = 1){
let activeTabID = await getactivetabid() let activeTabID = await getactivetabid()
closetabs(getnexttabs(activeTabID,n)) closetabs(await getnexttabs(activeTabID,n))
} }
export async function reload(n = 1, hard = false){
let tabstoreload = await getnexttabs(await getactivetabid(),n)
let reloadProperties = {bypassCache: hard}
tabstoreload.map(
(n)=>browser.tabs.reload(n, reloadProperties)
)
}
export async function reloadhard(n = 1){
reload(n, true)
}
/** Switch to the next tab by index (position on tab bar), wrapping round. /** Switch to the next tab by index (position on tab bar), wrapping round.

View file

@ -15,6 +15,8 @@ namespace Parsing {
["H", "historyback"], ["H", "historyback"],
["L", "historyforward"], ["L", "historyforward"],
["d", "tabclose"], ["d", "tabclose"],
["r", "reload"],
["R", "reloadhard"],
["k", "scrollupline"], ["k", "scrollupline"],
["gt", "tabnext"], ["gt", "tabnext"],
["gT", "tabprev"], ["gT", "tabprev"],