 
   load: -> 
     users = fetch '/users'
+    current_user = fetch '/current_user'  # subscribe for changes to login status & avatar
     return if !users.users 
 
     loading = fetch('avatar_loading')


          pic = new Image()
          pic.onload = do(user, pic) => => 
            cached_avatars[user.key] = @create_avatar pic
            @loading_cnt -= 1
            if @loading_cnt == 0
              loading.loading = false
              loading.loaded = true
              save loading
          pic.onerror = do(user) => =>
            @loading_cnt -= 1
            missing_images[user.key] = 1

          setTimeout do(user, pic) -> -> 
            pic.src = avatarUrl user, 'large'


cached_avatars = {}
missing_images = {}
loaded_images = {}

window.getCanvasAvatar = (user) ->
  cached_avatars[user.key or user] or cached_avatars.default
