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

Add second instance support #294

Merged
merged 2 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add second instance support
  • Loading branch information
Joe-Improbable committed Dec 2, 2020
commit c6a3253be10108d4eae4ca562a3395b58098e9ca
17 changes: 9 additions & 8 deletions astilectron.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
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