From 167ee90a704cc0fc8ccd7f4cc0184323f22d6da7 Mon Sep 17 00:00:00 2001 From: Bia41 Date: Mon, 31 Mar 2014 05:02:13 +0100 Subject: [PATCH] #673 Replaced .once with @listenToOnce Replaced .once with @listenToOnce on CocoModel, as requested on Issue #673 --- app/models/CocoModel.coffee | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/CocoModel.coffee b/app/models/CocoModel.coffee index 834dbe061..7337ccb83 100644 --- a/app/models/CocoModel.coffee +++ b/app/models/CocoModel.coffee @@ -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