mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
#673 Replaced .once with @listenToOnce
Replaced .once with @listenToOnce on CocoModel, as requested on Issue #673
This commit is contained in:
parent
53c20d3b9d
commit
167ee90a70
1 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue