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

Unified Diff: sky/examples/htmlish/framework/element.sky

Issue 980323003: Clean up examples directory (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/examples/fps-counter.sky ('k') | sky/examples/htmlish/framework/htmlish.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/htmlish/framework/element.sky
diff --git a/sky/examples/htmlish/framework/element.sky b/sky/examples/htmlish/framework/element.sky
deleted file mode 100644
index 9df9c0dd02235cdf9c04e0c9508ff4b13588547d..0000000000000000000000000000000000000000
--- a/sky/examples/htmlish/framework/element.sky
+++ /dev/null
@@ -1,70 +0,0 @@
-SKY MODULE - defines an <element> element
-<import src="sky:core" as="sky"/>
-
-<!-- usage:
-
- <element name="tagname">
- <style> style here (optional) </style>
- <template> shadow tree here (optional) </template>
- <script> // optional
- module.currentScript.parentNode.setPrototype({
- init: function () {
- // constructor here
- },
- // rest of api here
- });
- </script>
- </element>
-
--->
-
-<script>
- module.exports.Element = sky.registerElement(
- class extends Element {
- static get tagName() { return 'element'; }
- constructor (hostModule) {
- super(hostModule);
- this.state = 'loading';
- this.module = hostModule;
- this.definedPrototype = sky.Element;
- }
- setPrototype(prototype) {
- this.definedPrototype = prototype;
- }
- endTagParsedCallback() {
- let style = null;
- let template = null;
- let child = this.firstChild;
- while (child && !(style && template)) {
- if ((!style) && (child instanceof sky.StyleElement))
- style = child;
- if ((!template) && (template instanceof sky.TemplateElement))
- template = child;
- child = child.nextSibling;
- }
- let tagName = this.getAttribute('name');
- let constructorName = tagName.charAt(0).toUpperCase() + tagName.slice(1) + 'Element';
- let constructor = function (hostModule) {
- super(hostModule);
- if (this.init)
- this.init();
- if (style)
- this.shadowRoot.append(style.cloneNode(true));
- if (template)
- this.shadowRoot.append(template.cloneNode(true));
- }
- };
- if (this.definedPrototype)
- constructor.prototype = this.definedPrototype;
- else
- constructor.prototype = sky.Element;
- constructor.tagName = this.getAttribute('name');
- constructor.shadow = style || template;
- this.module.exports[constructorName] = this.registerElement(constructor);
- delete this.definedPrototype;
- delete this.module;
- this.state = 'loaded';
- }
- }
- );
-</script>
« no previous file with comments | « sky/examples/fps-counter.sky ('k') | sky/examples/htmlish/framework/htmlish.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698