diff --git a/packages/renderer/src/main.ts b/packages/renderer/src/main.ts index 0181f6b..4523c2b 100644 --- a/packages/renderer/src/main.ts +++ b/packages/renderer/src/main.ts @@ -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() }) diff --git a/packages/renderer/src/mainModules/nodeModulesSample.ts b/packages/renderer/src/mainModules/nodeModulesSample.ts deleted file mode 100644 index 36ee0bc..0000000 --- a/packages/renderer/src/mainModules/nodeModulesSample.ts +++ /dev/null @@ -1,31 +0,0 @@ -import path from 'path' -import { ipcRenderer } from 'electron' -import sqlite3 from 'sqlite3' - -const createSqlite3 = (userDataPath: string): Promise => { - 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