38. Ready Function
<template>
This element has a ready() method.
<span id="el">Not ready...</span>
</template>
<script>
Polymer({
owner: "Abechiyo",
ready: function() {
this.$.el.textContent = this.owner +
" is ready!";
}
});
</script>
39. Data binding
<template>
<b>{{old}}</b> years old.
My like color is <b>{{color}}</b>.
Name : <input type="range” value="{{old}}”>
Color : <input value="{{color}}” placeholder="Enter name...”>
</template>
<script>
Polymer({
old: ’25‘, //永遠の
color: 'green',
});
</script>
40. Web Componentsとは
● Templates
( 各パーツごとのテンプレートを作成)
● Shadow DOM
( ShadowRootで隠し、ページに埋め込む)
● Custom Elements
( 分かりやすタグを独自に作成し、挿入)
● Imports
( 各パーツをファイルごとに分解し、インポート)