Search code examples
javascriptwebbrowserelectrondexie

Dexie: How do I add a tab to the beginning?


We make an open source browser.

Please correct the add-on of the tabs. It is necessary that the tab is added to the beginning. Now the tab is added to the end:

var newTab = tabs.add({}, tabs.getIndex(tabs.getSelected()) + 1)

link to the GitHub repository

Tried these options:

tabs.add({}, 0)
tabs.add({})
tabs.put({})

How do I add a tab to the beginning?


Solution

  • Try the following:

    tabs.add({}, tabs[0]);
    

    What this does is it tells js to add the element at the beginning of the list (array). You can read more Here.

    Hope this helps!