Skip to content

Instantly share code, notes, and snippets.

@C-F-K
Created June 25, 2014 13:20
Show Gist options
  • Save C-F-K/8aeb4d15c0acd5d5d3ee to your computer and use it in GitHub Desktop.
Save C-F-K/8aeb4d15c0acd5d5d3ee to your computer and use it in GitHub Desktop.
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/firebase-element/firebase-element.html">
<polymer-element name="db-save">
<template>
<firebase-element id="db"
location="http://cth-storage.firebaseio.com/"
data="{{data}}"
keys="{{keys}}"
childEvents
log>
</firebase-element>
</template>
<script>
Polymer('db-save', {
publish: {
combinedvote: {}
},
didThing: 0,
combinedvoteChanged: function(){
if (!this.didThing) {
var user = this.combinedvote.userId;
this.data[user] = this.combinedvote;
this.$.db.commit();
this.didThing = 1;
}
}
});
</script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment