Skip to content

Instantly share code, notes, and snippets.

@josip
Created July 6, 2010 21:03
Show Gist options
  • Save josip/465905 to your computer and use it in GitHub Desktop.
Save josip/465905 to your computer and use it in GitHub Desktop.
da.db.BrowserCouch.get("chocolateStore", function (db) {
db.view({
id: "newChocolates",
map: function (doc, emit) {
emit(doc.id, doc);
},
finished: function (view) {
if(!view.rows.length)
console.log("Sorry we don't have any chocolates right now, please check back soon!");
},
updated: function (updated_view, view) {
var choco = updated_view.rows[0].value;
console.log("Yay! New", choco.type ,"chocolate by", choco.madeBy, "arrived!");
}
});
db.addEvent("updated.newChocolates", function (updated_view, view) {
console.log("Haha, now I'm 'gonna steal their chocolates!");
});
db.put({id: 1, madeBy: "Milka", type: "milk"});
db.put({id: 2, madeBy: "Milka", type: "dark"});
});
new da.util.ID3({
url: "http://server.org/file.mp3",
onSuccess: function (tags, frames) {
console.log(tags.song, "by", tags.artist, "from", tags.album);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment