forked from trent_larson/crowd-funder-for-time-pwa
Add single-instance enforcement to Electron app
- Implement app.requestSingleInstanceLock() to prevent multiple instances - Add user-friendly dialog when second instance is attempted - Focus and restore existing window instead of creating new instance - Prevent database corruption and resource conflicts - Update documentation with single-instance behavior details
This commit is contained in:
18
BUILDING.md
18
BUILDING.md
@@ -246,6 +246,24 @@ npm run build:electron:deb:prod
|
||||
npm run build:electron:dmg:prod
|
||||
```
|
||||
|
||||
### Single Instance Enforcement
|
||||
|
||||
The Electron app enforces single-instance operation to prevent:
|
||||
- Database corruption from multiple instances
|
||||
- Resource conflicts and performance issues
|
||||
- User confusion from multiple windows
|
||||
|
||||
**Behavior:**
|
||||
- Only one instance can run at a time
|
||||
- Attempting to launch a second instance shows a user-friendly dialog
|
||||
- The existing window is focused and restored if minimized
|
||||
- Second instance exits gracefully
|
||||
|
||||
**Implementation:**
|
||||
- Uses Electron's `requestSingleInstanceLock()` API
|
||||
- Handles `second-instance` events to focus existing window
|
||||
- Shows informative dialog explaining why only one instance is allowed
|
||||
|
||||
#### Direct Script Usage
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user