codecombat/app/collections/CocoCollection.coffee

22 lines
506 B
CoffeeScript
Raw Normal View History

CocoModel = require 'models/CocoModel'
2014-01-03 13:32:13 -05:00
module.exports = class CocoCollection extends Backbone.Collection
loaded: false
model: null
2014-01-03 13:32:13 -05:00
initialize: ->
if not @model
console.error @constructor.name, 'does not have a model defined. This will not do!'
2014-01-03 13:32:13 -05:00
super()
@once 'sync', =>
@loaded = true
model.loaded = true for model in @models
getURL: ->
return if _.isString @url then @url else @url()
fetch: ->
@jqxhr = super(arguments...)
@loading = true
@jqxhr