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

Side by Side Diff: sky/examples/shell/sensor.sky

Issue 980323003: Clean up examples directory (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « sky/examples/scrolling/scrolling.sky ('k') | sky/examples/style/block-layout.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <script>
2 import '/sky/framework/shell.dart' as shell;
3 import 'dart:sky';
4 import 'package:sky/services/sensors/sensors.mojom.dart';
5
6 class MyListener extends SensorListener {
7 int count = 0;
8
9 void onAccuracyChanged(int accuracy) {
10 print("onAccuracyChanged $accuracy");
11 }
12
13 void onSensorChanged(SensorData data) {
14 double value = data.values[0] + data.values[1] + data.values[2];
15 if (value > 40.0) {
16 document.querySelector('div').textContent =
17 "Shake count " + (count++).toString();
18 }
19 }
20
21 MyListener.unbound() {
22 stub = new SensorListenerStub.unbound()
23 ..delegate = this;
24 }
25
26 SensorListenerStub stub;
27 }
28
29 void main() {
30 var sensorService = new SensorServiceProxy.unbound();
31 shell.requestService(sensorService);
32
33 var listener = new MyListener.unbound();
34 sensorService.ptr.addListener(SensorType_ACCELEROMETER, listener.stub);
35 listener.stub.listen();
36 }
37 </script>
38 <div>Shake me.</div>
OLDNEW
« no previous file with comments | « sky/examples/scrolling/scrolling.sky ('k') | sky/examples/style/block-layout.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698