full notes file system architecture
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||
import { app, shell, BrowserWindow, ipcMain } from 'electron'
|
||||
import notesAPI, { ensureBaseDir } from './notesAPI'
|
||||
import NotesAPI from './notesAPI'
|
||||
import { join } from 'path'
|
||||
|
||||
const preloadPath = join(__dirname, '../preload/index.js')
|
||||
@@ -77,9 +77,6 @@ app.whenReady().then(() => {
|
||||
// Create main window
|
||||
createWindow()
|
||||
|
||||
// Ensure data directory is present
|
||||
ensureBaseDir()
|
||||
|
||||
app.on('activate', function () {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
@@ -91,8 +88,10 @@ app.whenReady().then(() => {
|
||||
createNoteWindow(noteId)
|
||||
})
|
||||
|
||||
// Handle calls to Notes API
|
||||
ipcMain.handle('notesAPI:call', async (_, method, args) => {
|
||||
// Init Notes API
|
||||
const notesAPI = new NotesAPI()
|
||||
notesAPI.init()
|
||||
ipcMain.handle('notesAPI:call', (_, method, args) => {
|
||||
if (!notesAPI[method]) {
|
||||
throw new Error('Invalid method')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user