This commit is contained in:
cupcakearmy
2020-09-17 14:27:08 +02:00
parent ba497e2b7a
commit 2d0de4373c
7 changed files with 7803 additions and 0 deletions

40
src/background/index.js Normal file
View File

@@ -0,0 +1,40 @@
import browser from 'webextension-polyfill'
// import Dexie from 'dexie'
// const db = new Dexie('myDb')
// db.version(1).stores({
// friends: `name, age`,
// })
// import NeDB from 'nedb'
// const db = new NeDB({filename: 'data.db'})
// db.insert({planet: 'Earth'})
import NeDB from 'nedb-promises'
const db = NeDB.create({
filename: 'data.db',
autoload: true,
})
async function main() {
await db.insert({ planet: 'Earth' })
console.log('Docs', await db.find())
}
// main()
async function getAllTabs() {
console.log('Getting all tabs')
const all = await browser.tabs.query({})
for (const tab of all) {
console.log(tab.title, tab.id, tab.active, tab.highlighted)
}
}
setInterval(() => {
getAllTabs()
}, 10000)
// document.addEventListener('DOMContentLoaded', () => {
// console.log('Hello from BG')
// })