Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic app boilerplate; display an empty window.
- Loading branch information
0 parents
commit 4a9e64a
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2015 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build darwin linux | ||
|
||
package main | ||
|
||
import ( | ||
"golang.org/x/mobile/app" | ||
"golang.org/x/mobile/event/lifecycle" | ||
"golang.org/x/mobile/event/paint" | ||
) | ||
|
||
func main() { | ||
app.Main(func(a app.App) { | ||
for e := range a.Events() { | ||
switch e := a.Filter(e).(type) { | ||
case lifecycle.Event: | ||
switch e.Crosses(lifecycle.StageVisible) { | ||
case lifecycle.CrossOn: | ||
// App visible. | ||
case lifecycle.CrossOff: | ||
// App no longer visible. | ||
} | ||
case paint.Event: | ||
a.Publish() | ||
} | ||
} | ||
}) | ||
} |