aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views/submit.js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-03-06 17:29:51 +0000
committerStruan Donald <struan@exo.org.uk>2013-03-06 17:29:51 +0000
commit5990502bf95e91036529a379a12c0d1f448ec197 (patch)
treeb7c87f65467d90b6c96ff6486f7854ddb3f130a1 /www/js/views/submit.js
parent1e0738707ce816ac33256f1092da35ffbcfee457 (diff)
use listenTo on the view as if we set the listener on the model the
destroy of a view can be fired after setting up listeners in the next view and hence the listeners are removed and no callbacks fire
Diffstat (limited to 'www/js/views/submit.js')
-rw-r--r--www/js/views/submit.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/www/js/views/submit.js b/www/js/views/submit.js
index 78e8c0a..c85f80d 100644
--- a/www/js/views/submit.js
+++ b/www/js/views/submit.js
@@ -16,8 +16,8 @@
},
initialize: function() {
- this.model.on('sync', this.onReportSync, this );
- this.model.on('error', this.onReportError, this );
+ this.listenTo(this.model, 'sync', this.onReportSync );
+ this.listenTo( this.model, 'error', this.onReportError );
},
render: function(){
@@ -58,8 +58,7 @@
beforeSubmit: function() {},
_destroy: function() {
- this.model.off('sync');
- this.model.off('error');
+ this.stopListening();
}
})
});
@@ -134,8 +133,8 @@
initialize: function() {
console.log('submit name initalize');
- this.model.on('sync', this.onReportSync, this );
- this.model.on('error', this.onReportError, this );
+ this.listenTo(this.model, 'sync', this.onReportSync );
+ this.listenTo( this.model, 'error', this.onReportError );
},
validate: function() {
@@ -189,8 +188,8 @@
},
initialize: function() {
- this.model.on('sync', this.onReportSync, this );
- this.model.on('error', this.onReportError, this );
+ this.listenTo(this.model, 'sync', this.onReportSync );
+ this.listenTo( this.model, 'error', this.onReportError );
},
validate: function() {