Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarikguney/electron-with-sqlite3
Sample application for ElectronJS working with Sqlite3
https://github.com/tarikguney/electron-with-sqlite3
desktop-app electronjs knexjs nodejs sqlite sqlite3
Last synced: about 1 month ago
JSON representation
Sample application for ElectronJS working with Sqlite3
- Host: GitHub
- URL: https://github.com/tarikguney/electron-with-sqlite3
- Owner: tarikguney
- Created: 2017-04-30T21:47:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T01:40:17.000Z (about 2 years ago)
- Last Synced: 2024-04-15T08:10:00.085Z (9 months ago)
- Topics: desktop-app, electronjs, knexjs, nodejs, sqlite, sqlite3
- Language: JavaScript
- Homepage:
- Size: 227 KB
- Stars: 124
- Watchers: 8
- Forks: 40
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Purpose
This repository contains sample code for the following areas:
1. Creating a new `BrowserWindow` and how to show and destroy it from the `MainProcess`.
2. Sending data between `RendererProcess` and `MainProcess` in Electron app.
3. Using `IPCRenderer` and `IPCMain` objects.
4. Connecting `Sqlite3` using `Knex` library.
5. Building and reading queries using `Knex` library.The shortcut for showing dev tools on windows in Electron is `Command` + `Alt` + `I` on MacOS.
# Notes
When sending data between `RenderProcess` and `MainProcess`, there are two important code pieces:
1. `IPCMain` and `IPCRenderer`
2. `BrowserWindow.webContents.send()``WebContents` contains events, etc. for a window. `IPC` means inter-process communication. The idea here is events. You can fire an event by using `send()` method along with data to pass, and the subscribers listening to it get the data passed.
Also, when I was working with `Sqlite3`, I got errors with it not being found. Therefore, I had to install `electron-rebuild` dev-dependency and rebuilt the `electron` with it by calling `npm run rebuild`. `package.json` has the setting for the rebuild command.