diff options
| author | Juuso Lapinlampi <wub@partyvan.eu> | 2015-09-27 20:57:51 +0200 |
|---|---|---|
| committer | Juuso Lapinlampi <wub@partyvan.eu> | 2015-09-27 21:09:41 +0200 |
| commit | a17c4461869fc93e48c00cbb12dc588aa9b25f89 (patch) | |
| tree | 66bc9e17578e77d8e8f6fc4177beeed2636340c2 /js/cheesesteak.js | |
| parent | 2c7ced1f503299e6ede6d3ef2b5e115318f5401f (diff) | |
Add missing newlines after blocks
Fixes JSCS requirePaddingNewLinesAfterBlocks warnings using Airbnb
preset.
Diffstat (limited to 'js/cheesesteak.js')
| -rw-r--r-- | js/cheesesteak.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/js/cheesesteak.js b/js/cheesesteak.js index 112b2c7..75f837e 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -24,17 +24,21 @@ (function() { /* Lightweight EventEmitter implementation */ EventEmitter = function() {}; + EventEmitter.prototype.on = function(evt, fn) { this._events = this._events || {}; this._events[evt] = this._events[evt] || []; this._events[evt].push(fn); }; + EventEmitter.prototype.off = function(evt, fn) { if (!this.hasOwnProperty('_events') || evt in this._events === false) { return; } + this._events[evt].splice(this._events[evt].indexOf(fn), 1); }; + EventEmitter.prototype.emit = function(evt) { if (!this.hasOwnProperty('_events') || evt in this._events === false) { return; @@ -113,6 +117,7 @@ out[key] = overlay[key]; } } + return out; }; @@ -128,6 +133,7 @@ 'data': {} }, opts); }; + FileListUploader.prototype = Object.create(EventEmitter.prototype); FileListUploader.prototype.upload = function(cb) { if (cb) { @@ -151,6 +157,7 @@ files[i].uploadedSize = 0; } }); + xhr.upload.addEventListener('progress', function(e) { if (e.lengthComputable) { size = e.loaded; @@ -168,17 +175,22 @@ } } } + events.emit('uploadprogress', e, files); }, false); + xhr.upload.addEventListener('loadstart', function(e) { events.emit('uploadstart', e); }); + xhr.upload.addEventListener('load', function(e) { events.emit('uploadcomplete', e); }); + xhr.addEventListener('progress', function(e) { events.emit('progress', e); }); + xhr.addEventListener('load', function(e) { events.emit('load', e, xhr.responseText); }); |
