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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/generator/chrome/sample.dart

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 import 'dart:html'; 1 import 'dart:html';
2 import 'dart:js'; 2 import 'dart:js';
3 3
4 int boundsChange = 100; 4 int boundsChange = 100;
5 5
6 /** 6 /**
7 * For non-trivial uses of the Chrome apps API, please see the 7 * For non-trivial uses of the Chrome apps API, please see the
8 * [chrome](http://pub.dartlang.org/packages/chrome). 8 * [chrome](http://pub.dartlang.org/packages/chrome).
9 * 9 *
10 * * http://developer.chrome.com/apps/api_index.html 10 * * http://developer.chrome.com/apps/api_index.html
11 */ 11 */
12 void main() { 12 void main() {
13 query("#sample_text_id") 13 querySelector("#sample_text_id")
14 ..text = "Click me!" 14 ..text = "Click me!"
15 ..onClick.listen(resizeWindow); 15 ..onClick.listen(resizeWindow);
16 } 16 }
17 17
18 void resizeWindow(MouseEvent event) { 18 void resizeWindow(MouseEvent event) {
19 JsObject appWindow = 19 JsObject appWindow =
20 context['chrome']['app']['window'].callMethod('current', []); 20 context['chrome']['app']['window'].callMethod('current', []);
21 JsObject bounds = appWindow.callMethod('getBounds', []); 21 JsObject bounds = appWindow.callMethod('getBounds', []);
22 22
23 bounds['width'] += boundsChange; 23 bounds['width'] += boundsChange;
24 bounds['left'] -= boundsChange ~/ 2; 24 bounds['left'] -= boundsChange ~/ 2;
25 25
26 appWindow.callMethod('setBounds', [bounds]); 26 appWindow.callMethod('setBounds', [bounds]);
27 27
28 boundsChange *= -1; 28 boundsChange *= -1;
29 } 29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698