Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: third_party/go/src/golang.org/x/mobile/app/app.go

Issue 1275153002: Remove third_party/golang.org/x/mobile as it is no longer used with Go 1.5. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove golang.org/x/mobile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // +build linux darwin
6
7 package app
8
9 import (
10 "io"
11
12 "golang.org/x/mobile/event"
13 )
14
15 // Run starts the app.
16 //
17 // It must be called directly from the main function and will
18 // block until the app exits.
19 func Run(cb Callbacks) {
20 run(cb)
21 }
22
23 // Callbacks is the set of functions called by the app.
24 type Callbacks struct {
25 // Start is called when the app enters the foreground.
26 // The app will start receiving Draw and Touch calls.
27 //
28 // If the app is responsible for the screen (that is, it is an
29 // all-Go app), then Window geometry will be configured and an
30 // OpenGL context will be available during Start.
31 //
32 // If this is a library, Start will be called before the
33 // app is told that Go has finished initialization.
34 //
35 // Start is an equivalent lifecycle state to onStart() on
36 // Android and applicationDidBecomeActive on iOS.
37 Start func()
38
39 // Stop is called shortly before a program is suspended.
40 //
41 // When Stop is received, the app is no longer visible and not is
42 // receiving events. It should:
43 //
44 // - Save any state the user expects saved (for example text).
45 // - Release all resources that are not needed.
46 //
47 // Execution time in the stop state is limited, and the limit is
48 // enforced by the operating system. Stop as quickly as you can.
49 //
50 // An app that is stopped may be started again. For example, the user
51 // opens Recent Apps and switches to your app. A stopped app may also
52 // be terminated by the operating system with no further warning.
53 //
54 // Stop is equivalent to onStop() on Android and
55 // applicationDidEnterBackground on iOS.
56 Stop func()
57
58 // Draw is called by the render loop to draw the screen.
59 //
60 // Drawing is done into a framebuffer, which is then swapped onto the
61 // screen when Draw returns. It is called 60 times a second.
62 Draw func()
63
64 // Touch is called by the app when a touch event occurs.
65 Touch func(event.Touch)
66 }
67
68 // Open opens a named asset.
69 //
70 // On Android, assets are accessed via android.content.res.AssetManager.
71 // These files are stored in the assets/ directory of the app. Any raw asset
72 // can be accessed by its direct relative name. For example assets/img.png
73 // can be opened with Open("img.png").
74 //
75 // On iOS an asset is a resource stored in the application bundle.
76 // Resources can be loaded using the same relative paths.
77 //
78 // For consistency when debugging on a desktop, assets are read from a
79 // directoy named assets under the current working directory.
80 func Open(name string) (ReadSeekCloser, error) {
81 return openAsset(name)
82 }
83
84 // ReadSeekCloser is an io.ReadSeeker and io.Closer.
85 type ReadSeekCloser interface {
86 io.ReadSeeker
87 io.Closer
88 }
89
90 // State is global application-specific state.
91 //
92 // The State variable also holds operating system specific state.
93 // Android apps have the extra methods:
94 //
95 // // JavaVM returns a JNI *JavaVM.
96 // JavaVM() unsafe.Pointer
97 //
98 // // AndroidContext returns a jobject for the app android.context.Context.
99 // AndroidContext() unsafe.Pointer
100 //
101 // State is not valid until Run has been called.
102 var State interface{}
OLDNEW
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/app/android_x86.c ('k') | third_party/go/src/golang.org/x/mobile/app/darwin_amd64.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698