Skip to content

Instantly share code, notes, and snippets.

@C-F-K
Created May 24, 2014 18:28
Show Gist options
  • Save C-F-K/ccc1b2482304a1776b36 to your computer and use it in GitHub Desktop.
Save C-F-K/ccc1b2482304a1776b36 to your computer and use it in GitHub Desktop.
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/core-firebase/core-firebase.html">
<polymer-element name="discount-room">
<template>
<core-firebase location="https://discount-app.firebaseio.com/"
list="{{discount}}"
on-items-added={{update}}>
<input id="uchar" type="text"></input>
<button id="submit" on-click={{sendChar}}>Submit</button>
<hr>
<pre id="display"></pre>
</template>
<script>
Polymer('discount-room', {
ready: function (){
console.log(this.discount);
},
sendChar: function sendChar(){
console.log(this.discount);
chr = this.$.uchar.value;
this.discount.push({uchar: chr, posx: 0, posy: 0});
console.log(this.discount);
},
update: function update(){
this.$.display.innerHTML = JSON.stringify(this.discount);
}
});
</script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment