Skip to content

Commit

Permalink
Moved event back into initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
raindrift committed Oct 26, 2013
1 parent f6292fe commit 0191f9a
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 59 deletions.
36 changes: 19 additions & 17 deletions dist/mass-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,29 @@ define('MassUpload',['backbone', 'underscore', 'MassUpload/UploadCollection', 'M
return Backbone.Model.call(this, {}, options);
},
initialize: function(attributes, options) {
var _ref,
_this = this;
this._options = options;
this.uploads = (_ref = options != null ? options.uploads : void 0) != null ? _ref : new UploadCollection();
this.listenTo(this.uploads, 'add change:file change:error', function(upload) {
return _this._onUploadAdded(upload);
});
this.listenTo(this.uploads, 'change:deleting', function(upload) {
return _this._onUploadDeleted(upload);
});
this.listenTo(this.uploads, 'remove', function(upload) {
return _this._onUploadRemoved(upload);
});
this.listenTo(this.uploads, 'reset', function() {
return _this._onUploadsReset();
});
return this.prepare();
},
prepare: function() {
var options, resetUploadProgress, uploadProgress, _ref, _ref1, _ref2, _ref3,
var options, resetUploadProgress, uploadProgress, _ref, _ref1, _ref2,
_this = this;
options = this._options;
this.uploads = (_ref = options != null ? options.uploads : void 0) != null ? _ref : new UploadCollection();
this.lister = (_ref1 = options != null ? options.lister : void 0) != null ? _ref1 : new FileLister(options.doListFiles);
this.lister = (_ref = options != null ? options.lister : void 0) != null ? _ref : new FileLister(options.doListFiles);
this.lister.callbacks = {
onStart: function() {
return _this._onListerStart();
Expand All @@ -529,7 +543,7 @@ define('MassUpload',['backbone', 'underscore', 'MassUpload/UploadCollection', 'M
return _this._onListerStop();
}
};
this.uploader = (_ref2 = options != null ? options.uploader : void 0) != null ? _ref2 : new FileUploader(options.doUploadFile);
this.uploader = (_ref1 = options != null ? options.uploader : void 0) != null ? _ref1 : new FileUploader(options.doUploadFile);
this.uploader.callbacks = {
onStart: function(file) {
return _this._onUploaderStart(file);
Expand All @@ -547,7 +561,7 @@ define('MassUpload',['backbone', 'underscore', 'MassUpload/UploadCollection', 'M
return _this._onUploaderProgress(file, progressEvent);
}
};
this.deleter = (_ref3 = options != null ? options.deleter : void 0) != null ? _ref3 : new FileDeleter(options.doDeleteFile);
this.deleter = (_ref2 = options != null ? options.deleter : void 0) != null ? _ref2 : new FileDeleter(options.doDeleteFile);
this.deleter.callbacks = {
onStart: function(fileInfo) {
return _this._onDeleterStart(fileInfo);
Expand All @@ -562,18 +576,6 @@ define('MassUpload',['backbone', 'underscore', 'MassUpload/UploadCollection', 'M
return _this._onDeleterStop(fileInfo);
}
};
this.listenTo(this.uploads, 'add change:file change:error', function(upload) {
return _this._onUploadAdded(upload);
});
this.listenTo(this.uploads, 'change:deleting', function(upload) {
return _this._onUploadDeleted(upload);
});
this.listenTo(this.uploads, 'remove', function(upload) {
return _this._onUploadRemoved(upload);
});
this.listenTo(this.uploads, 'reset', function() {
return _this._onUploadsReset();
});
uploadProgress = new UploadProgress({
collection: this.uploads
});
Expand Down
2 changes: 1 addition & 1 deletion dist/mass-upload.min.js

Large diffs are not rendered by default.

36 changes: 19 additions & 17 deletions dist/mass-upload.no-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -916,15 +916,29 @@ define('MassUpload',['backbone', 'underscore', 'MassUpload/UploadCollection', 'M
return Backbone.Model.call(this, {}, options);
},
initialize: function(attributes, options) {
var _ref,
_this = this;
this._options = options;
this.uploads = (_ref = options != null ? options.uploads : void 0) != null ? _ref : new UploadCollection();
this.listenTo(this.uploads, 'add change:file change:error', function(upload) {
return _this._onUploadAdded(upload);
});
this.listenTo(this.uploads, 'change:deleting', function(upload) {
return _this._onUploadDeleted(upload);
});
this.listenTo(this.uploads, 'remove', function(upload) {
return _this._onUploadRemoved(upload);
});
this.listenTo(this.uploads, 'reset', function() {
return _this._onUploadsReset();
});
return this.prepare();
},
prepare: function() {
var options, resetUploadProgress, uploadProgress, _ref, _ref1, _ref2, _ref3,
var options, resetUploadProgress, uploadProgress, _ref, _ref1, _ref2,
_this = this;
options = this._options;
this.uploads = (_ref = options != null ? options.uploads : void 0) != null ? _ref : new UploadCollection();
this.lister = (_ref1 = options != null ? options.lister : void 0) != null ? _ref1 : new FileLister(options.doListFiles);
this.lister = (_ref = options != null ? options.lister : void 0) != null ? _ref : new FileLister(options.doListFiles);
this.lister.callbacks = {
onStart: function() {
return _this._onListerStart();
Expand All @@ -942,7 +956,7 @@ define('MassUpload',['backbone', 'underscore', 'MassUpload/UploadCollection', 'M
return _this._onListerStop();
}
};
this.uploader = (_ref2 = options != null ? options.uploader : void 0) != null ? _ref2 : new FileUploader(options.doUploadFile);
this.uploader = (_ref1 = options != null ? options.uploader : void 0) != null ? _ref1 : new FileUploader(options.doUploadFile);
this.uploader.callbacks = {
onStart: function(file) {
return _this._onUploaderStart(file);
Expand All @@ -960,7 +974,7 @@ define('MassUpload',['backbone', 'underscore', 'MassUpload/UploadCollection', 'M
return _this._onUploaderProgress(file, progressEvent);
}
};
this.deleter = (_ref3 = options != null ? options.deleter : void 0) != null ? _ref3 : new FileDeleter(options.doDeleteFile);
this.deleter = (_ref2 = options != null ? options.deleter : void 0) != null ? _ref2 : new FileDeleter(options.doDeleteFile);
this.deleter.callbacks = {
onStart: function(fileInfo) {
return _this._onDeleterStart(fileInfo);
Expand All @@ -975,18 +989,6 @@ define('MassUpload',['backbone', 'underscore', 'MassUpload/UploadCollection', 'M
return _this._onDeleterStop(fileInfo);
}
};
this.listenTo(this.uploads, 'add change:file change:error', function(upload) {
return _this._onUploadAdded(upload);
});
this.listenTo(this.uploads, 'change:deleting', function(upload) {
return _this._onUploadDeleted(upload);
});
this.listenTo(this.uploads, 'remove', function(upload) {
return _this._onUploadRemoved(upload);
});
this.listenTo(this.uploads, 'reset', function() {
return _this._onUploadsReset();
});
uploadProgress = new UploadProgress({
collection: this.uploads
});
Expand Down
Loading

0 comments on commit 0191f9a

Please sign in to comment.