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

Side by Side Diff: sky/examples/htmlish/framework/element.sky

Issue 730223002: Specs: default exports to {} rather than document, since it makes writing modules saner (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | sky/examples/radio.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 - defines an <element> element 1 SKY MODULE - defines an <element> element
2 <import src="sky:core" as="sky"/> 2 <import src="sky:core" as="sky"/>
3 3
4 <!-- usage: 4 <!-- usage:
5 5
6 <element name="tagname"> 6 <element name="tagname">
7 <style> style here (optional) </style> 7 <style> style here (optional) </style>
8 <template> shadow tree here (optional) </template> 8 <template> shadow tree here (optional) </template>
9 <script> // optional 9 <script> // optional
10 module.currentScript.parentNode.setPrototype({ 10 module.currentScript.parentNode.setPrototype({
11 init: function () { 11 init: function () {
12 // constructor here 12 // constructor here
13 }, 13 },
14 // rest of api here 14 // rest of api here
15 }); 15 });
16 </script> 16 </script>
17 </element> 17 </element>
18 18
19 --> 19 -->
20 20
21 <script> 21 <script>
22 module.exports.Element = sky.registerElement({ 22 module.exports.Element = sky.registerElement({
23 tagName: 'element', 23 tagName: 'element',
24 prototype: class extends Element { 24 constructor: class extends Element {
25 constructor (module) { 25 constructor (module) {
26 super(); 26 super();
27 this.state = 'loading'; 27 this.state = 'loading';
28 this.module = module; 28 this.module = module;
29 this.definedPrototype = sky.Element; 29 this.definedPrototype = sky.Element;
30 } 30 }
31 setPrototype(prototype) { 31 setPrototype(prototype) {
32 this.definedPrototype = prototype; 32 this.definedPrototype = prototype;
33 } 33 }
34 endTagParsedCallback() { 34 endTagParsedCallback() {
(...skipping 28 matching lines...) Expand all
63 shadow: style || template, 63 shadow: style || template,
64 constructor: constructor, 64 constructor: constructor,
65 }); 65 });
66 delete this.definedPrototype; 66 delete this.definedPrototype;
67 delete this.module; 67 delete this.module;
68 this.state = 'loaded'; 68 this.state = 'loaded';
69 } 69 }
70 }, 70 },
71 }); 71 });
72 </script> 72 </script>
OLDNEW
« no previous file with comments | « no previous file | sky/examples/radio.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698