Skip to content

Instantly share code, notes, and snippets.

@possibilities
Created June 2, 2012 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save possibilities/2860160 to your computer and use it in GitHub Desktop.
Save possibilities/2860160 to your computer and use it in GitHub Desktop.
if (Meteor.is_client) {
Chatrooms = new Meteor.Collection('chatRooms');
Meteor.subscribe('chatRooms');
var rooms = Chatrooms.find();
Meteor.startup(function() {
var roomResults = Meteor.ui.render(function() {
var templateResults = Template.roomList({ rooms: rooms });
return templateResults;
});
$('body').append(roomResults);
});
}
if (Meteor.is_server) {
Chatrooms = new Meteor.Collection('chatRooms');
Chatrooms.remove({});
Chatrooms.insert({
name: 'moof'
});
Chatrooms.insert({
name: 'doof'
});
Meteor.publish('chatRooms', function() {
return Chatrooms.find();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment