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

Side by Side Diff: sky/examples/calculator/buttons.sky

Issue 829133003: Specs: custom element constructor argument shouldn't clash with the module-global 'module' identifi… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | sky/examples/htmlish/framework/element.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 SKY MODULE - button widgets for calculator 1 SKY MODULE - button widgets for calculator
2 <!-- TODO(ianh): implement accessibility handling once the ax service exists --> 2 <!-- TODO(ianh): implement accessibility handling once the ax service exists -->
3 3
4 <script> 4 <script>
5 class AbstractButton extends Element { 5 class AbstractButton extends Element {
6 constructor (module) { 6 constructor (hostModule) {
7 super(module); 7 super(hostModule);
8 let selector = new SelectorQuery('.dynamic'); 8 let selector = new SelectorQuery('.dynamic');
9 this.addEventListener('pointer-down', (event) => { 9 this.addEventListener('pointer-down', (event) => {
10 selector.findAll(this.shadowRoot).every((element) => element.setAttribut e('clicked')); 10 selector.findAll(this.shadowRoot).every((element) => element.setAttribut e('clicked'));
11 // TODO(ianh): track the pointer; if it leaves the button, cancel the cl ick 11 // TODO(ianh): track the pointer; if it leaves the button, cancel the cl ick
12 // TOOD(ianh): if the pointer doesn't leave the button before being rele ased, then fire some event on ourselves 12 // TOOD(ianh): if the pointer doesn't leave the button before being rele ased, then fire some event on ourselves
13 module.application.document.addEventListener('pointer-up', function upHa ndler (event) { 13 module.application.document.addEventListener('pointer-up', function upHa ndler (event) {
14 module.application.document.removeEventListener('pointer-up', upHandle r); 14 module.application.document.removeEventListener('pointer-up', upHandle r);
15 selector.findAll(this.shadowRoot).every((element) => element.removeAtt ribute('clicked')); 15 selector.findAll(this.shadowRoot).every((element) => element.removeAtt ribute('clicked'));
16 }); 16 });
17 }); 17 });
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 <content/> 52 <content/>
53 </div> 53 </div>
54 </template> 54 </template>
55 55
56 <script> 56 <script>
57 module.exports = { 57 module.exports = {
58 ThreeDButtonElement: module.registerElement( 58 ThreeDButtonElement: module.registerElement(
59 class extends AbstractButton { 59 class extends AbstractButton {
60 static get tagName() { return 'graybutton'; } 60 static get tagName() { return 'graybutton'; }
61 static get shadow() { return true; } 61 static get shadow() { return true; }
62 constructor (module) { 62 constructor (hostModule) {
63 super(module); 63 super(hostModule);
64 this.shadowRoot.append(module.document.findId('threed-button-shadow-tre e').cloneNode(true)); 64 this.shadowRoot.append(module.document.findId('threed-button-shadow-tre e').cloneNode(true));
65 } 65 }
66 } 66 }
67 ), 67 ),
68 FlatButtonElement: module.registerElement( 68 FlatButtonElement: module.registerElement(
69 class extends AbstractButton { 69 class extends AbstractButton {
70 static get tagName() { return 'flatbutton'; } 70 static get tagName() { return 'flatbutton'; }
71 static get shadow() { return true; } 71 static get shadow() { return true; }
72 constructor (module) { 72 constructor (hostModule) {
73 super(module); 73 super(hostModule);
74 this.shadowRoot.append(module.document.findId('flat-shadow-tree').clone Node(true)); 74 this.shadowRoot.append(module.document.findId('flat-shadow-tree').clone Node(true));
75 } 75 }
76 } 76 }
77 ), 77 ),
78 }; 78 };
79 </script> 79 </script>
OLDNEW
« no previous file with comments | « no previous file | sky/examples/htmlish/framework/element.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698