Add nextTab, attempt some not-inline stuff

This commit is contained in:
Oliver Blanthorn 2017-02-13 18:11:13 +00:00
parent 58ae747714
commit b4f660ccc8

View file

@ -11,4 +11,24 @@ handleBrowserAction = () ->
# the real thing.
browser.browserAction.onClicked.addListener(handleBrowserAction)
nextTab = () ->
browser.tabs.query({active:true}).then((tabs) ->
id = tabs[0].id
index = tabs[0].index
desIndex = index + 1
browser.tabs.query({}).then((tabs) ->
desId = tab for tab in tabs when tab.index == desIndex
setTab(desId.id)
)
)
setTab = (id) ->
browser.tabs.update(id,{active:true})
tabByIndex = (index) ->
browser.tabs.query({}).then((tabs) ->
desiredTab = tab for tab in tabs when tab.index == desIndex
)
console.log("Loaded Tridactyl")