Documentation
¶
Overview ¶
Package event defines what happens in the app that another part of it reacts to: one Go type per event, the name each is known by, and the Sink that receives them.
Services emit events into the Sink they are given; the desktop shell is the one Sink of the running app. A WindowEvent is passed on to the frontend under its Name, with the event itself as the data, and the desktop bootstrap registers each one's type under that name, so the generated bindings type the frontend's listeners. The other events stay in Go: the shell acts on them itself.
Index ¶
- Constants
- type BudgetUpdated
- type Discard
- type Event
- type FirstPaint
- type GHThreadsUpdated
- type HooksUpdated
- type InboxUpdated
- type IntegrationsChanged
- type IntervalsChanged
- type IssueProgress
- type MenuBarChanged
- type NotificationsUpdated
- type QuitConfirmed
- type QuitKept
- type QuitRequested
- type Relay
- type ReleasesPhase
- type ReleasesProgress
- type ReleasesUpdated
- type RepoRulesChanged
- type ResetRequested
- type RevealItem
- type ReviewProgress
- type ScriptRunProgress
- type ScriptRunsUpdated
- type ServiceStatusUpdated
- type SessionsUpdated
- type SetupFinished
- type Sink
- type StatusRulesChanged
- type TextSizeChanged
- type ThemeChanged
- type ThreadRulesChanged
- type ToolsUpdated
- type UpdateQuitHeld
- type UpdateRestartFailed
- type UpdateRestartRequested
- type UpdatesChanged
- type UpdatesUpdated
- type WindowEvent
- type WorktreesPhase
- type WorktreesProgress
- type WorktreesUpdated
Constants ¶
const ( // NameInboxUpdated is InboxUpdated's name. NameInboxUpdated = "inbox:updated" // NameRevealItem is RevealItem's name. NameRevealItem = "inbox:reveal" // NameWorktreesUpdated is WorktreesUpdated's name. NameWorktreesUpdated = "worktrees:updated" // NameNotificationsUpdated is NotificationsUpdated's name. NameNotificationsUpdated = "notifications:updated" // NameBudgetUpdated is BudgetUpdated's name. NameBudgetUpdated = "budget:updated" // NameSessionsUpdated is SessionsUpdated's name. NameSessionsUpdated = "sessions:updated" // NameReviewProgress is ReviewProgress's name. NameReviewProgress = "review:progress" // NameIssueProgress is IssueProgress's name. NameIssueProgress = "issue:progress" // NameThemeChanged is ThemeChanged's name. NameThemeChanged = "settings:theme" // NameTextSizeChanged is TextSizeChanged's name. NameTextSizeChanged = "settings:textSize" // NameMenuBarChanged is MenuBarChanged's name. NameMenuBarChanged = "settings:menuBar" // NameFirstPaint is FirstPaint's name. NameFirstPaint = "app:firstPaint" // NameToolsUpdated is ToolsUpdated's name. NameToolsUpdated = "tools:updated" // NameIntegrationsChanged is IntegrationsChanged's name. NameIntegrationsChanged = "integrations:changed" // NameScriptRunsUpdated is ScriptRunsUpdated's name. NameScriptRunsUpdated = "scriptruns:updated" // NameScriptRunProgress is ScriptRunProgress's name. NameScriptRunProgress = "scriptruns:progress" // NameQuitRequested is QuitRequested's name. NameQuitRequested = "app:quitRequested" // NameQuitConfirmed is QuitConfirmed's name. NameQuitConfirmed = "app:quitConfirmed" // NameQuitKept is QuitKept's name. NameQuitKept = "app:quitKept" // NameReleasesUpdated is ReleasesUpdated's name. NameReleasesUpdated = "releases:updated" // NameReleasesProgress is ReleasesProgress's name. NameReleasesProgress = "releases:progress" // NameHooksUpdated is HooksUpdated's name. NameHooksUpdated = "hooks:updated" // NameWorktreesProgress is WorktreesProgress's name. NameWorktreesProgress = "worktrees:progress" // NameIntervalsChanged is IntervalsChanged's name. NameIntervalsChanged = "settings:intervalsChanged" // NameRepoRulesChanged is RepoRulesChanged's name. NameRepoRulesChanged = "settings:repoRulesChanged" // NameThreadRulesChanged is ThreadRulesChanged's name. NameThreadRulesChanged = "settings:threadRulesChanged" // NameStatusRulesChanged is StatusRulesChanged's name. NameStatusRulesChanged = "settings:statusRulesChanged" // NameGHThreadsUpdated is GHThreadsUpdated's name. NameGHThreadsUpdated = "ghthreads:updated" // NameServiceStatusUpdated is ServiceStatusUpdated's name. NameServiceStatusUpdated = "servicestatus:updated" // NameSetupFinished is SetupFinished's name. NameSetupFinished = "setup:finished" // NameResetRequested is ResetRequested's name. NameResetRequested = "app:resetRequested" // NameUpdatesChanged is UpdatesChanged's name. NameUpdatesChanged = "settings:updatesChanged" // NameUpdatesUpdated is UpdatesUpdated's name. NameUpdatesUpdated = "updates:updated" // NameUpdateRestartRequested is UpdateRestartRequested's name. NameUpdateRestartRequested = "updates:restart" // NameUpdateRestartFailed is UpdateRestartFailed's name. NameUpdateRestartFailed = "updates:restartFailed" // NameUpdateQuitHeld is UpdateQuitHeld's name. NameUpdateQuitHeld = "updates:quitHeld" )
The events' names. A window event's name is part of the frontend's contract: the generated bindings key its type by it, and the frontend listens for it.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BudgetUpdated ¶
type BudgetUpdated struct{}
BudgetUpdated says a GitHub API budget changed, as a response reported it, or what the app spent from one: the window reads the budgets again.
type Event ¶
type Event interface {
// Name is the name the event is known by.
Name() string
}
Event is something that happened, or was asked for, that another part of the app reacts to.
type FirstPaint ¶
type FirstPaint struct {
// Measurement is the time from process start to the first paint.
Measurement timing.Measurement
}
FirstPaint says the window painted its first frame. It comes once per run, and ends a startup measurement.
type GHThreadsUpdated ¶
type GHThreadsUpdated struct{}
GHThreadsUpdated says what the window shows of the user's GitHub notifications changed: a pass read them, or checked their items' states, and found something new; reading them was turned off; or whether GitHub lets the token read them, or the last pass's error, changed. The window reads them again. A pass that changed nothing tells nothing.
func (GHThreadsUpdated) Name ¶
func (GHThreadsUpdated) Name() string
Name returns NameGHThreadsUpdated.
type HooksUpdated ¶
type HooksUpdated struct{}
HooksUpdated says the Hooks page's list changed: a clone was scanned again, or a hooks action or a checks run ended. The window reads the list again, which serves what is kept and scans again only the clones that changed.
type InboxUpdated ¶
type InboxUpdated struct{}
InboxUpdated says the stored inbox, or the status of its last refresh, changed: the window reads the inbox again, and the menu bar redraws.
type IntegrationsChanged ¶
type IntegrationsChanged struct {
// CopyChosen reports a chosen copy of a tool, rather than a switch.
CopyChosen bool
}
IntegrationsChanged says the user flipped an integration's switch or chose a copy of a tool, and it was stored. Core has the integrations look for the tools again when a copy was chosen, and otherwise tells the window that what they list changed.
func (IntegrationsChanged) Name ¶
func (IntegrationsChanged) Name() string
Name returns NameIntegrationsChanged.
type IntervalsChanged ¶
type IntervalsChanged struct{}
IntervalsChanged says the user changed how often the app reads something again on its own (the inbox, the running checks, the Release page's running checks, the worktrees, the GitHub notifications, the status pages), and it was stored. It stays in Go: core wakes what reads them again, which works its next wait out from the new interval.
func (IntervalsChanged) Name ¶
func (IntervalsChanged) Name() string
Name returns NameIntervalsChanged.
type IssueProgress ¶
type IssueProgress struct {
// ItemID is the stored issue the action is on.
ItemID int64 `json:"itemId"`
// Step says what the action is doing now.
Step string `json:"step"`
}
IssueProgress says what the issue sheet's action on an issue is doing now, as in "Checking for new comments since you opened it" or "Closing as completed", so the sheet can show each step while the user waits for GitHub.
type MenuBarChanged ¶
type MenuBarChanged struct {
// On is whether the icon shows.
On bool
}
MenuBarChanged says the user turned the menu bar icon on or off and it was stored.
type NotificationsUpdated ¶
type NotificationsUpdated struct{}
NotificationsUpdated says the notification log changed: the window reads it again.
func (NotificationsUpdated) Name ¶
func (NotificationsUpdated) Name() string
Name returns NameNotificationsUpdated.
type QuitConfirmed ¶
type QuitConfirmed struct {
// Restarting marks the restart to update's confirmation, which quits nothing itself.
Restarting bool
}
QuitConfirmed says the user chose to stop the runs and quit. The desktop shell hears it, lets the next quit through, and quits; shutdown stops the runs.
A restart to update sends it with Restarting set, just before the update's installer quits the app itself: the shell then lets every quit through, whatever runs go, but quits nothing, since a quit of its own could come before the installer's helper stands by. A held quit would leave that helper to open this copy again beside the new one.
type QuitKept ¶ added in v0.3.1
type QuitKept struct{}
QuitKept says the user chose to keep the app running when its quit asked first (Keep running). It stays in Go: the desktop shell forgets the copy a move to Applications asked to open once the app quits, so a later quit opens nothing.
type QuitRequested ¶
type QuitRequested struct{}
QuitRequested says the user asked to quit while runs are going in the app: the window asks whether to stop them and quit, or keep running.
type Relay ¶
type Relay struct {
// contains filtered or unexported fields
}
Relay is a Sink that passes each event on to the Sink it is connected to, and drops events until it is. It lets the services that emit be built before the Sink that hears them, as the desktop shell is, which needs those services. It is safe for concurrent use; the zero value is ready.
type ReleasesPhase ¶
type ReleasesPhase string
ReleasesPhase is how far a read of the Release page's list has got.
const ( // ReleasesFindingClones is the clone root being searched for clones. ReleasesFindingClones ReleasesPhase = "clones" // ReleasesAskingGitHub is GitHub being asked about each clone's repository. ReleasesAskingGitHub ReleasesPhase = "github" // ReleasesComparing is GitHub being asked how far each default branch is ahead of its // newest version. ReleasesComparing ReleasesPhase = "compare" // ReleasesCheckingClones is the unreleased clones being read. ReleasesCheckingClones ReleasesPhase = "checking" )
The phases of a read of the Release page's list, in order.
type ReleasesProgress ¶
type ReleasesProgress struct {
Phase ReleasesPhase `json:"phase"`
Done int `json:"done"`
Total int `json:"total"`
}
ReleasesProgress says how far a read of the Release page's list has got, while it runs: its phase, and how many of the phase's repositories or clones are done. Finding the clones counts nothing, and the read of a released repository alone finds none. It comes a few times a second at most, and ReleasesUpdated follows once the read lands.
func (ReleasesProgress) Name ¶
func (ReleasesProgress) Name() string
Name returns NameReleasesProgress.
type ReleasesUpdated ¶
type ReleasesUpdated struct{}
ReleasesUpdated says the Release page's list changed: it was read again from GitHub, in full or, after a release ended, for the repository released alone; a release ended, and its repository is being read again, so the list reads as refreshing until that lands; or the list went out of date. The window reads it, and a list out of date is read again from GitHub then.
func (ReleasesUpdated) Name ¶
func (ReleasesUpdated) Name() string
Name returns NameReleasesUpdated.
type RepoRulesChanged ¶
type RepoRulesChanged struct{}
RepoRulesChanged says the user pinned or muted a repository or an org, or took the rule off, and it was stored. It stays in Go: core tells the window the inbox changed, which the menu bar shows too, and has the Release page regroup its list.
func (RepoRulesChanged) Name ¶
func (RepoRulesChanged) Name() string
Name returns NameRepoRulesChanged.
type ResetRequested ¶ added in v0.3.0
type ResetRequested struct{}
ResetRequested says the user asked to start over, and the request is written: the desktop shell lets the quit through, quits, and opens the app again, whose start carries the reset out.
func (ResetRequested) Name ¶ added in v0.3.0
func (ResetRequested) Name() string
Name returns NameResetRequested.
type RevealItem ¶
type RevealItem struct {
// ItemID is the stored item to show, or 0 for none.
ItemID int64 `json:"itemId"`
// URL is the item on GitHub, which the window opens when the item is no longer in
// the inbox, or the page of a notification about no item.
URL string `json:"url"`
// RunID is the run to open, which a failed run's notification names, or 0 for none, and
// RunStarted when it started, as RFC 3339: the window opens the run only while the run
// with that ID started then.
RunID int64 `json:"runId"`
RunStarted string `json:"runStarted"`
// NotificationID is the notification a clicked banner stands for, which the window
// marks read, or 0 for none: a summary's, a session's, the menu bar's, or a session's
// focus. The window marks it only while the log's entry with that ID is about this
// item, URL, or run, since the log hands an ID out again once it is cleared.
NotificationID int64 `json:"notificationId"`
}
RevealItem asks for the window to come forward with an item in view, for a click on the item in the menu bar or on its notification, or with the run a notification is about open in Scripts → Runs. A click on a banner also names the notification it stands for, which the window marks read. A request that names no item, URL, run, or notification, such as a click on a banner that stands for many items, only brings the window forward; the frontend is not told.
type ReviewProgress ¶
type ReviewProgress struct {
// ItemID is the stored pull request the action is on.
ItemID int64 `json:"itemId"`
// Step says what the action is doing now.
Step string `json:"step"`
}
ReviewProgress says what the review sheet's action on a pull request is doing now, as in "Approving" or "Checking that GitHub can merge it", so the sheet can show each step while the user waits for GitHub.
type ScriptRunProgress ¶
type ScriptRunProgress struct {
// ID is the run's ID.
ID int64 `json:"id"`
}
ScriptRunProgress says one run going now changed its progress (scriptrun.Progress): it reached a step, or Stop turned on or off. The window reads that run again, and only that one; the history is as it was. It never carries output.
func (ScriptRunProgress) Name ¶
func (ScriptRunProgress) Name() string
Name returns NameScriptRunProgress.
type ScriptRunsUpdated ¶
type ScriptRunsUpdated struct{}
ScriptRunsUpdated says a run started, ended, or changed status, or the history changed: the window lists the runs again and pulls what it shows. It never carries output.
func (ScriptRunsUpdated) Name ¶
func (ScriptRunsUpdated) Name() string
Name returns NameScriptRunsUpdated.
type ServiceStatusUpdated ¶
type ServiceStatusUpdated struct{}
ServiceStatusUpdated says a pass of the service status check ended, whether its checks worked or not, or what the user watches changed: the window reads the status again.
func (ServiceStatusUpdated) Name ¶
func (ServiceStatusUpdated) Name() string
Name returns NameServiceStatusUpdated.
type SessionsUpdated ¶
type SessionsUpdated struct{}
SessionsUpdated says an agent session was launched, or changed what it is doing: the window reads the sessions again, and the menu bar redraws.
func (SessionsUpdated) Name ¶
func (SessionsUpdated) Name() string
Name returns NameSessionsUpdated.
type SetupFinished ¶ added in v0.3.0
type SetupFinished struct{}
SetupFinished says the user finished the first-run setup, or skipped it. The desktop shell hears it and asks once to allow notification banners, which it held while the setup showed, so the question comes when the user lands in the inbox, not before they know what the app does.
func (SetupFinished) Name ¶ added in v0.3.0
func (SetupFinished) Name() string
Name returns NameSetupFinished.
type Sink ¶
type Sink interface {
Emit(e Event)
}
Sink receives events. Emit must return promptly and must not call back into the service that emitted: services emit while they hold their own locks.
type StatusRulesChanged ¶
type StatusRulesChanged struct{}
StatusRulesChanged says the user turned a status page on or off, or ticked or unticked a part of one to watch, and it was stored. It stays in Go: core has the service status check follow it, forgetting a provider turned off and checking one turned on at once; the window has the settings from the setter already, and hears the status changed.
func (StatusRulesChanged) Name ¶
func (StatusRulesChanged) Name() string
Name returns NameStatusRulesChanged.
type TextSizeChanged ¶
type TextSizeChanged struct {
// Size is the stored text size: one of the settings package's text size choices.
Size string
}
TextSizeChanged says the user chose a text size and it was stored. The shell sets the window's smallest size to suit it; the page shows the size itself.
func (TextSizeChanged) Name ¶
func (TextSizeChanged) Name() string
Name returns NameTextSizeChanged.
type ThemeChanged ¶
type ThemeChanged struct {
// Theme is the stored theme: one of the settings package's theme choices.
Theme string
}
ThemeChanged says the user chose a theme and it was stored. The shell brings the window's native appearance along with it; the page has already switched itself.
type ThreadRulesChanged ¶
type ThreadRulesChanged struct{}
ThreadRulesChanged says the user changed a rule for their GitHub notifications (whether they are read, whether, how, and when they are cleared), and it was stored. It stays in Go: core has the mirror of the notifications decide every thread again at once, so clearing turned off stops at once, and turned on clears what is finished.
func (ThreadRulesChanged) Name ¶
func (ThreadRulesChanged) Name() string
Name returns NameThreadRulesChanged.
type ToolsUpdated ¶
type ToolsUpdated struct{}
ToolsUpdated says what the integrations service lists changed: a detection or an update check finished, or a run started or ended, which can block or free a tool's update. The window reads the list again.
type UpdateQuitHeld ¶ added in v0.3.1
type UpdateQuitHeld struct {
// HelperStarted is when the restart began starting the helper, just before the
// runtime's restart was called: the helper's wait for the app to exit starts soon
// after, so the shell times its exit from here, never from when this arrived, which a
// quit slow to return delays.
HelperStarted time.Time
}
UpdateQuitHeld says a restart to update staged the update and started the runtime's helper, but the quit that should have ended the app was held (a modal panel, say), so the app runs on while the helper waits for it to exit. It stays in Go: the shell asks to quit again a few times and, failing that, shuts down in order and exits, so the helper installs the update instead of giving up and opening this copy again beside it.
func (UpdateQuitHeld) Name ¶ added in v0.3.1
func (UpdateQuitHeld) Name() string
Name returns NameUpdateQuitHeld.
type UpdateRestartFailed ¶ added in v0.3.1
type UpdateRestartFailed struct{}
UpdateRestartFailed says a restart to update failed after its QuitConfirmed let the quit through, and the app runs on. It stays in Go: the shell holds a quit while runs go again.
func (UpdateRestartFailed) Name ¶ added in v0.3.1
func (UpdateRestartFailed) Name() string
Name returns NameUpdateRestartFailed.
type UpdateRestartRequested ¶ added in v0.3.1
type UpdateRestartRequested struct{}
UpdateRestartRequested asks the window to restart to update, as the menu bar's Restart to Update does: every restart starts in the window, which asks first when restarting would lose something.
func (UpdateRestartRequested) Name ¶ added in v0.3.1
func (UpdateRestartRequested) Name() string
Name returns NameUpdateRestartRequested.
type UpdatesChanged ¶ added in v0.3.1
type UpdatesChanged struct{}
UpdatesChanged says the user chose what the app does when a new version is out, and it was stored. It stays in Go: core wakes the update check, which follows the new choice at once (a version found while the app only told is downloaded once the user asks for downloads); the window has the settings from the setter, and hears the update's status changed.
func (UpdatesChanged) Name ¶ added in v0.3.1
func (UpdatesChanged) Name() string
Name returns NameUpdatesChanged.
type UpdatesUpdated ¶ added in v0.3.1
type UpdatesUpdated struct{}
UpdatesUpdated says the app's update changed: a check started or ended, a download got further (a few times a second at most), a version is ready, a restart began or failed, or Later was chosen or lifted. The window reads the update's status again, and the menu bar redraws.
func (UpdatesUpdated) Name ¶ added in v0.3.1
func (UpdatesUpdated) Name() string
Name returns NameUpdatesUpdated.
type WindowEvent ¶
type WindowEvent interface {
Event
// contains filtered or unexported methods
}
WindowEvent is an event the frontend hears too. Only this package's types are window events, so the set the desktop bootstrap registers is the set WindowEvents returns.
func WindowEvents ¶
func WindowEvents() []WindowEvent
WindowEvents returns one of each window event. The repository's checks compare it with the events the desktop bootstrap registers.
type WorktreesPhase ¶
type WorktreesPhase string
WorktreesPhase is how far a listing of the worktrees has got.
const ( // WorktreesFindingClones is the clone root being searched for clones. WorktreesFindingClones WorktreesPhase = "clones" // WorktreesListing is each clone's worktrees being listed. WorktreesListing WorktreesPhase = "listing" // WorktreesChecking is each worktree being read: its changes, its branch, and its // commits. WorktreesChecking WorktreesPhase = "checking" // WorktreesAskingGitHub is GitHub being asked about the pull requests and issues the // worktrees belong to. WorktreesAskingGitHub WorktreesPhase = "github" )
The phases of a listing of the worktrees, in order.
type WorktreesProgress ¶
type WorktreesProgress struct {
Phase WorktreesPhase `json:"phase"`
Done int `json:"done"`
Total int `json:"total"`
}
WorktreesProgress says how far the window's listing of the worktrees has got, while it runs: its phase, and how many of the phase's clones, worktrees, or pull requests and issues are done. Finding the clones counts nothing. It comes a few times a second at most, and the listing's own answer follows it; a listing another job runs, such as the sweep, tells nothing.
func (WorktreesProgress) Name ¶
func (WorktreesProgress) Name() string
Name returns NameWorktreesProgress.
type WorktreesUpdated ¶
type WorktreesUpdated struct{}
WorktreesUpdated says an automatic worktree sweep removed a worktree or changed how many need attention: the window reads the latest sweep.
func (WorktreesUpdated) Name ¶
func (WorktreesUpdated) Name() string
Name returns NameWorktreesUpdated.