Skip to content

Instantly share code, notes, and snippets.

@gabrielhpugliese
Created September 14, 2012 22:48
Show Gist options
  • Save gabrielhpugliese/3725454 to your computer and use it in GitHub Desktop.
Save gabrielhpugliese/3725454 to your computer and use it in GitHub Desktop.
Nomes = new Meteor.Collection("nomes");
Nome = {
remove : function(nome) {
return Nomes.remove({
nome : nome
});
},
get : function(nome) {
return Nomes.findOne({
nome : nome
});
},
set : function(nome) {
return Nomes.insert({
nome : nome
});
}
};
window.onbeforeunload = function(e) {
var message = "Your confirmation message goes here.";
var nome = Session.get('nome');
Nome.remove(nome);
Meteor.flush();
return message;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment