overleaf/services/chat/public/coffee/models/user.coffee

13 lines
299 B
CoffeeScript
Raw Normal View History

2014-08-15 05:50:36 -04:00
define [
"libs/backbone"
], (Backbone, room) ->
User = Backbone.Model.extend {},
findOrCreate: (attributes) ->
User.cache ||= {}
if User.cache[attributes.id]?
return User.cache[attributes.id]
else
user = new User(attributes)
User.cache[attributes.id] = user
return user