mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
13 lines
299 B
CoffeeScript
13 lines
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
|