Skip to content

Instantly share code, notes, and snippets.

Created September 18, 2012 19:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Users = new Meteor.Collection 'users'
currentUser = ->
Users.findOne Session.get 'user_id'
if Meteor.is_client
Meteor.startup = ->
Meteor.autosubscribe = ->
Meteor.subscribe 'users'
Template.users_to_interrupt.users = ->
usersint = Session.get 'users_to_interrupt'
if usersint
Users.find { username: { $in: (usersint || []) } }
'click button.add': ->
username = $('#add_username').val()
console.log "got username '#{username}' in add user textfield"
array = Session.get('users_to_interrupt') || [] # if we do Session.get here it screws up notifying on Session.set later! must get the value otherwise somehow
# array = [] # just adding an empty array and pushing username to it works, and updates "users" reactively
Session.set 'users_to_interrupt', array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment