1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < script >
5+ // IE/Edge polyfill.
6+ if ( ! window . customElements ) {
7+ document . writeln ( '<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.23/webcomponents-lite.js"><\/script>' ) ;
8+ document . write ( '<!--' ) ;
9+ }
10+ </ script >
11+ < script type ="text/javascript " src ="../../smart-core/smart-core/source-minified/native-shim.js "> </ script >
12+ < script type ="text/javascript " src ="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.0.22/webcomponents-lite.js "> </ script >
13+ <!--! do not remove -->
14+ < script >
15+ // IE polyfill.
16+ if ( ! ( window . CSS && window . CSS . supports && window . CSS . supports ( '(--fake-var: 0)' ) ) ) {
17+ document . writeln ( '<link rel="stylesheet" href="../../smart-core/smart-core/source-minified/styles/smart.base-novars.css" type="text/css" />' ) ;
18+ document . write ( '<!--' ) ;
19+ }
20+ </ script >
21+ < link rel ="stylesheet " href ="../../smart-core/smart-core/source-minified/styles/smart.base.css " type ="text/css " />
22+ <!--! do not remove -->
23+ < link rel ="stylesheet " href ="../styles/demos.css " type ="text/css " />
24+ < script type ="text/javascript " src ="../../smart-core/smart-core/source-minified/smart.element-polyfills.js "> </ script >
25+ < script type ="text/javascript " src ="../../smart-core/smart-core/source-minified/smart.element.js "> </ script >
26+ < script type ="text/javascript " src ="../../smart-core/smart-core/source-minified/smart.button.js "> </ script >
27+ < script >
28+ class ColorModule {
29+ static get properties ( ) {
30+ var properties =
31+ {
32+ 'color' : {
33+ value : 'red' ,
34+ type : 'string' ,
35+ observer : 'setColor'
36+ }
37+ }
38+
39+ return properties ;
40+ }
41+
42+ attached ( ) {
43+ }
44+
45+ detached ( ) {
46+ }
47+
48+ created ( ) {
49+ }
50+
51+ ready ( ) {
52+ this . ownerElement . $ . button . style . color = this . color ;
53+ }
54+
55+ setColor ( oldColor , color ) {
56+ this . ownerElement . $ . button . style . color = this . color ;
57+ }
58+ }
59+
60+ window . Smart . Elements . whenRegistered ( 'smart-button' , function ( proto ) {
61+ proto . addModule ( ColorModule ) ;
62+ } ) ;
63+ </ script >
64+
65+ < script >
66+ function clickMe ( event ) {
67+ var button = document . getElementById ( "button" ) ;
68+ button . color = 'green' ;
69+ }
70+ </ script >
71+ </ head >
72+ < body >
73+ < smart-button id ="button " onclick ="clickMe(event) "> Click Me</ smart-button >
74+ </ body >
75+ </ html >
0 commit comments