This repository was archived by the owner on Sep 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathquit.go
44 lines (36 loc) · 1.49 KB
/
quit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright ©2018-2020 by Richard A. Wilkes. All rights reserved.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, version 2.0. If a copy of the MPL was not distributed with
// this file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// This Source Code Form is "Incompatible With Secondary Licenses", as
// defined by the Mozilla Public License, version 2.0.
package webapp
// Possible termination responses
const (
Cancel QuitResponse = iota
Now
Later // Must make a call to MayQuitNow() at some point in the future.
)
// QuitResponse is used to respond to requests for app termination.
type QuitResponse int
// QuitAfterLastWindowClosedCallback is called when the last window is closed
// to determine if the application should quit as a result. Default returns
// yes.
var QuitAfterLastWindowClosedCallback = func() bool { return true }
// AttemptQuit initiates the termination sequence.
func AttemptQuit() {
driver.AttemptQuit()
}
// CheckQuitCallback is called when termination has been requested. Default
// returns Now.
var CheckQuitCallback = func() QuitResponse { return Now }
// MayQuitNow resumes the termination sequence that was delayed when Later is
// returned from CheckQuit. Passing in false for the quit parameter will
// cancel the termination sequence while true will allow it to proceed.
func MayQuitNow(quit bool) {
driver.MayQuitNow(quit)
}
// QuittingCallback is called when the app will in fact terminate.
var QuittingCallback = func() {}