#673 Replaced .once with @listenToOnce

Replaced .once with @listenToOnce on CocoModel, as requested on Issue #673
This commit is contained in:
Bia41 2014-03-31 05:02:13 +01:00
parent 53c20d3b9d
commit 167ee90a70

View file

@ -55,10 +55,12 @@ class CocoModel extends Backbone.Model
loadSchema: ->
return if @constructor.schema.loading
@constructor.schema.fetch()
@constructor.schema.once 'sync', =>
@constructor.schema.loaded = true
@addSchemaDefaults()
@trigger 'schema-loaded'
@listenToOnce(@constructor.schema, 'sync', @onConstructorSync)
onConstructorSync: ->
@constructor.schema.loaded = true
@addSchemaDefaults()
@trigger 'schema-loaded'
@hasSchema: -> return @schema?.loaded
schema: -> return @constructor.schema