overleaf/services/chat/public/coffee/models/user.coffee
2014-08-15 10:50:36 +01:00

13 lines
No EOL
299 B
CoffeeScript

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