-
Notifications
You must be signed in to change notification settings - Fork 0
/
my-component.html
37 lines (29 loc) · 1.38 KB
/
my-component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link rel="import" href="/bower_components/polymer/polymer.html">
<!-- Define web component name and public API (attributes) -->
<polymer-element name="my-component" attributes="name settings">
<template>
<p>Hello {{name}}, I can't believe <strong style="font-size:{{settings.size}}; color:{{settings.color}};">this is your favourite color!</strong></p>
</template>
<script>
Polymer('my-component', {
// Fires when an instance of the element is created. Define attributes defaults. Initialize non string attributes.
created: function() {
this.name = 'Jon Coucou';
this.settings = {
color: 'green',
size: '40px'
};
},
// Fires when the element’s initial set of children and siblings are guaranteed to exist
domReady: function() {},
// Fires when the "<polymer-element>" has been fully prepared
ready: function() {},
// Fires when the element was inserted into the document
attached: function() {},
// Fires when the element was removed from the document
detached: function() {},
// Fires when an attribute was added, removed, or updated
attributeChanged: function(attr, oldVal, newVal) {}
});
</script>
</polymer-element>