| OLD | NEW |
| 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 } |
| OLD | NEW |