Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
Add second instance support (#294)
Browse files Browse the repository at this point in the history
* add second instance support

* update astilectron version
  • Loading branch information
Joe-Improbable committed Dec 8, 2020
1 parent a6679a0 commit d10987f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
19 changes: 10 additions & 9 deletions astilectron.go
Expand Up @@ -13,7 +13,7 @@ import (
// Versions
const (
DefaultAcceptTCPTimeout = 30 * time.Second
DefaultVersionAstilectron = "0.41.0"
DefaultVersionAstilectron = "0.42.0"
DefaultVersionElectron = "7.1.10"
)

Expand All @@ -28,14 +28,15 @@ var (

// App event names
const (
EventNameAppClose = "app.close"
EventNameAppCmdQuit = "app.cmd.quit" // Sends an event to Electron to properly quit the app
EventNameAppCmdStop = "app.cmd.stop" // Cancel the context which results in exiting abruptly Electron's app
EventNameAppCrash = "app.crash"
EventNameAppErrorAccept = "app.error.accept"
EventNameAppEventReady = "app.event.ready"
EventNameAppNoAccept = "app.no.accept"
EventNameAppTooManyAccept = "app.too.many.accept"
EventNameAppClose = "app.close"
EventNameAppCmdQuit = "app.cmd.quit" // Sends an event to Electron to properly quit the app
EventNameAppCmdStop = "app.cmd.stop" // Cancel the context which results in exiting abruptly Electron's app
EventNameAppCrash = "app.crash"
EventNameAppErrorAccept = "app.error.accept"
EventNameAppEventReady = "app.event.ready"
EventNameAppEventSecondInstance = "app.event.second.instance"
EventNameAppNoAccept = "app.no.accept"
EventNameAppTooManyAccept = "app.too.many.accept"
)

// Astilectron represents an object capable of interacting with Astilectron
Expand Down
7 changes: 7 additions & 0 deletions event.go
Expand Up @@ -41,6 +41,7 @@ type Event struct {
Password string `json:"password,omitempty"`
Reply string `json:"reply,omitempty"`
Request *EventRequest `json:"request,omitempty"`
SecondInstance *EventSecondInstance `json:"secondInstance,omitempty"`
SessionID string `json:"sessionId,omitempty"`
Supported *Supported `json:"supported,omitempty"`
TrayOptions *TrayOptions `json:"trayOptions,omitempty"`
Expand Down Expand Up @@ -116,6 +117,12 @@ type EventRequest struct {
URL string `json:"url,omitempty"`
}

// EventSecondInstance represents data related to a second instance of the app being started
type EventSecondInstance struct {
CommandLine []string `json:"commandLine,omitempty"`
WorkingDirectory string `json:"workingDirectory,omitempty"`
}

// EventSubMenu represents a sub menu event
type EventSubMenu struct {
ID string `json:"id"`
Expand Down

0 comments on commit d10987f

Please sign in to comment.