Skip to content

Instantly share code, notes, and snippets.

@vsergeyev
Created December 19, 2012 21:36
Show Gist options
  • Save vsergeyev/4340743 to your computer and use it in GitHub Desktop.
Save vsergeyev/4340743 to your computer and use it in GitHub Desktop.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type='text/javascript' src='https://cdn.firebase.com/v0/firebase.js'></script>
<script src="firebase-models.js"></script>
<script>
var Chat = {};
$.extend(Chat, FirebaseModels.Model, {
type: "Chat",
firebase: new Firebase("https://blabla.firebaseio-demo.com/Chat/")
});
Chat.put({"text": "Hi there!"}, function(id) {console.log("OK", id);}, function() {console.log("ERROR!!!");});
Chat.get("19b3ef3e-dc65-74b0-bada-f40085459d29", function(item) {console.log(item)});
Chat.get("not-existing-item-id", function(item) {console.log(item)});
Chat.all(function(items) {console.log(items)});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment