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

Unified Diff: sky/framework/sky-button.sky

Issue 946813005: Port Sky widgets demo to Dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/sky-box.sky ('k') | sky/framework/sky-checkbox.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/sky-button.sky
diff --git a/sky/framework/sky-button.sky b/sky/framework/sky-button.sky
index 6fa66a477aaf20531349fd1348595c6de1f57df3..09a5b79a0982ec9034ef51127f328082eed8a093 100644
--- a/sky/framework/sky-button.sky
+++ b/sky/framework/sky-button.sky
@@ -1,16 +1,11 @@
<!--
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-->
-<import src="sky-element/sky-element.sky" as="SkyElement" />
+<import src="sky-element.sky" />
-<sky-element
- name="sky-button"
- attributes="highlight:boolean"
- on-pointerdown="handlePointerDown"
- on-pointerup="handlePointerUp"
- on-pointercancel="handlePointerCancel">
+<sky-element attributes="highlight:boolean">
<template>
<style>
:host {
@@ -29,21 +24,31 @@
<content />
</template>
<script>
-module.exports = class extends SkyElement {
- created() {
- super.created();
+import "dart:sky";
- this.tabIndex = 0; // Make focusable.
+@Tagname('sky-button')
+class SkyButton extends SkyElement {
+ SkyButton() {
+ addEventListener('pointerdown', _handlePointerDown);
+ addEventListener('pointerup', _handlePointerUp);
+ addEventListener('pointercancel', _handlePointerCancel);
+
+ tabIndex = 0; // Make focusable.
}
- handlePointerDown() {
- this.highlight = true;
+
+ void _handlePointerDown(_) {
+ highlight = true;
}
- handlePointerUp() {
- this.highlight = false;
+
+ void _handlePointerUp(_) {
+ highlight = false;
}
- handlePointerCancel() {
- this.highlight = false;
+
+ void _handlePointerCancel(_) {
+ highlight = false;
}
-}.register();
+}
+
+_init(script) => register(script, SkyButton);
</script>
</sky-element>
« no previous file with comments | « sky/framework/sky-box.sky ('k') | sky/framework/sky-checkbox.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698