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

Side by Side Diff: sky/examples/widgets/index.sky

Issue 812713005: Add declarataive event handlers. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add tests and fix binding Created 6 years 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 | « no previous file | sky/framework/sky-element/TemplateBinding.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 --> 5 -->
6 <sky> 6 <sky>
7 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement"/> 7 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement"/>
8 <import src="/sky/framework/sky-button/sky-button.sky"/> 8 <import src="/sky/framework/sky-button/sky-button.sky"/>
9 <import src="/sky/framework/sky-box/sky-box.sky"/> 9 <import src="/sky/framework/sky-box/sky-box.sky"/>
10 <import src="/sky/framework/sky-checkbox/sky-checkbox.sky"/> 10 <import src="/sky/framework/sky-checkbox/sky-checkbox.sky"/>
11 <import src="/sky/framework/sky-radio/sky-radio.sky"/> 11 <import src="/sky/framework/sky-radio/sky-radio.sky"/>
12 <sky-element name="widget-root"> 12 <sky-element name="widget-root">
13 <template> 13 <template>
14 <style> 14 <style>
15 div { display: paragraph; } 15 div { display: paragraph; }
16 </style> 16 </style>
17 17
18 <sky-box title='Buttons'> 18 <sky-box title='Buttons'>
19 <sky-button id='button'>Button</sky-button> 19 <sky-button id='button' on-click='handleClick'>Button</sky-button>
20 <div>highlight: {{ myButton.highlight }}</div> 20 <div>highlight: {{ myButton.highlight }}</div>
21 <div>clickCount: {{ clickCount }}</div>
21 </sky-box> 22 </sky-box>
22 23
23 <sky-box title='Checkboxes'> 24 <sky-box title='Checkboxes'>
24 <div><sky-checkbox id='checkbox' />Checkbox</div> 25 <div><sky-checkbox id='checkbox' />Checkbox</div>
25 <div>highlight: {{ myCheckbox.highlight }}</div> 26 <div>highlight: {{ myCheckbox.highlight }}</div>
26 <div>checked: {{ myCheckbox.checked }}</div> 27 <div>checked: {{ myCheckbox.checked }}</div>
27 28
28 <div><sky-checkbox id='checkbox' checked='true'/>Checkbox, default checked.< /div> 29 <div><sky-checkbox id='checkbox' checked='true'/>Checkbox, default checked.< /div>
29 </sky-box> 30 </sky-box>
30 31
31 <sky-box title='Radios'> 32 <sky-box title='Radios'>
32 <sky-box title='Group One'> 33 <sky-box title='Group One'>
33 <div><sky-radio group='foo'/>one</div> 34 <div><sky-radio group='foo'/>one</div>
34 <div><sky-radio group='foo' selected='true' />two</div> 35 <div><sky-radio group='foo' selected='true' />two</div>
35 <div><sky-radio group='foo'/>three</div> 36 <div><sky-radio group='foo'/>three</div>
36 </sky-box> 37 </sky-box>
37 <sky-box title='Group Two'> 38 <sky-box title='Group Two'>
38 <div><sky-radio group='bar'/>A</div> 39 <div><sky-radio group='bar'/>A</div>
39 <div><sky-radio group='bar'/>B</div> 40 <div><sky-radio group='bar'/>B</div>
40 <div><sky-radio group='bar' selected='true' />C</div> 41 <div><sky-radio group='bar' selected='true' />C</div>
41 </sky-box> 42 </sky-box>
42 </sky-box> 43 </sky-box>
43 44
44 </template> 45 </template>
45 <script> 46 <script>
46 module.exports = class extends SkyElement { 47 module.exports = class extends SkyElement {
47 attached() { 48 attached() {
48 this.myButton = this.shadowRoot.getElementById('button'); 49 this.myButton = this.shadowRoot.getElementById('button');
49 this.myCheckbox = this.shadowRoot.getElementById('checkbox'); 50 this.myCheckbox = this.shadowRoot.getElementById('checkbox');
51 this.clickCount = 0;
52 }
53 handleClick(event) {
54 this.clickCount++;
50 } 55 }
51 }.register(); 56 }.register();
52 </script> 57 </script>
53 </sky-element> 58 </sky-element>
54 59
55 <widget-root /> 60 <widget-root />
56 </sky> 61 </sky>
OLDNEW
« no previous file with comments | « no previous file | sky/framework/sky-element/TemplateBinding.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698