remove sqlite3 relative code

This commit is contained in:
草鞋没号 2022-03-23 16:50:59 +08:00
parent a6fdb6469b
commit 646c6bd0c4
2 changed files with 0 additions and 33 deletions

View File

@ -2,7 +2,6 @@ import { createApp } from 'vue'
import App from './App.vue'
import ipcRendererSample from './mainModules/ipcRendererSample'
import fsExample from './mainModules/builtinModuleSample'
import sqliteExample from './mainModules/nodeModulesSample'
createApp(App)
.mount('#app')
@ -10,5 +9,4 @@ createApp(App)
window.removeLoading()
ipcRendererSample()
fsExample()
sqliteExample()
})

View File

@ -1,31 +0,0 @@
import path from 'path'
import { ipcRenderer } from 'electron'
import sqlite3 from 'sqlite3'
const createSqlite3 = (userDataPath: string): Promise<sqlite3.Database> => {
return new Promise((resolve, reject) => {
const dbpath = path.join(userDataPath, 'sqlite3.db')
console.log(dbpath)
const db = new sqlite3.Database(dbpath, (error) => {
if (error) {
reject(error)
return
}
resolve(db)
})
})
}
const sqliteExample = () => {
ipcRenderer.on('app.getPath', async (_, userDataPath) => {
try {
const db = await createSqlite3(userDataPath)
console.log(db)
} catch (error) {
console.error(error)
}
})
ipcRenderer.send('app.getPath', 'userData')
}
export default sqliteExample