adding yatta-element
This commit is contained in:
15
examples/Polymer/index.html
Normal file
15
examples/Polymer/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8 />
|
||||
<title>Yatta+Polymer Example</title>
|
||||
<script src="../../bower_components/webcomponentsjs/webcomponents.min.js"></script>
|
||||
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
||||
|
||||
<link rel="import" href="yatta-test.html">
|
||||
</head>
|
||||
<body>
|
||||
<yatta-test></yatta-test>
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
18
examples/Polymer/index.js
Normal file
18
examples/Polymer/index.js
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
window.onload = function(){
|
||||
window.x = document.querySelector("yatta-test");
|
||||
x.yatta.val("stuff",{otherstuff:{nostuff:"this is no stuff"}})
|
||||
setTimeout(function(){
|
||||
var res = x.yatta.val("stuff");
|
||||
if(!(x.nostuff.val() === "this is no stuff")){
|
||||
console.log("Deep inherit doesn't work")
|
||||
}
|
||||
window.y_stuff_property.val = {nostuff: "this is also no stuff"};
|
||||
setTimeout(function(){
|
||||
if(!(x.nostuff.val() === "this is also no stuff")){
|
||||
console.log("Element val overwrite doesn't work")
|
||||
}
|
||||
console.log("res");
|
||||
},500)
|
||||
},500);
|
||||
}
|
||||
26
examples/Polymer/yatta-test.html
Normal file
26
examples/Polymer/yatta-test.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<link rel="import" href="../../yatta-element.html">
|
||||
|
||||
<link rel="import" href="../../bower_components/connector/peerjs-connector/peerjs-connector.html">
|
||||
|
||||
<polymer-element name="yatta-test" attributes="yatta connector stuff">
|
||||
<template>
|
||||
<peerjs-connector id="connector" conn_id="1234" key="h7nlefbgavh1tt9" connector={{connector}}></peerjs-connector>
|
||||
<yatta-element connector={{connector}} val={{yatta}}>
|
||||
<yatta-property name="stuff" val={{stuff}}>
|
||||
<yatta-property id="otherstuff" name="otherstuff" val={{otherstuff}}>
|
||||
</yatta-property>
|
||||
</yatta-property>
|
||||
</yatta-element>
|
||||
<yatta-element val={{otherstuff}}>
|
||||
<yatta-property name="nostuff" val={{nostuff}}>
|
||||
</yatta-property>
|
||||
</yatta-element>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
ready: function(){
|
||||
window.y_stuff_property = this.$.otherstuff;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</polymer-element>
|
||||
Reference in New Issue
Block a user