From f77007e047406eaccb3b3a8d4252aacab775f58d Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Thu, 15 Oct 2015 21:55:55 +0200 Subject: [PATCH] Fix some lint errors from previous commit. --- static/cosmopolite.js | 19 ++++++++++++------- static/test.js | 3 ++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/static/cosmopolite.js b/static/cosmopolite.js index 1dce891..f3a92e0 100644 --- a/static/cosmopolite.js +++ b/static/cosmopolite.js @@ -290,8 +290,10 @@ Cosmopolite.prototype.subscribe = function(subjects, opt_messages, opt_lastID) { var subject = subjects[i]; ret.push(this.newPromise_(function(resolve, reject) { - if (subject['local'] && (subject['readable_only_by'] || subject['writable_only_by'])) { - console.log(this.loggingPrefix_(), 'local subjects can\'t have ACLs:', subject); + if (subject['local'] && + (subject['readable_only_by'] || subject['writable_only_by'])) { + console.log(this.loggingPrefix_(), + 'local subjects can\'t have ACLs:', subject); reject(); return; } @@ -407,8 +409,10 @@ Cosmopolite.prototype.unsubscribe = function(subject) { */ Cosmopolite.prototype.sendMessage = function(subject, message) { return this.newPromise_(function(resolve, reject) { - if (subject['local'] && (subject['readable_only_by'] || subject['writable_only_by'])) { - console.log(this.loggingPrefix_(), 'local subjects can\'t have ACLs:', subject); + if (subject['local'] && + (subject['readable_only_by'] || subject['writable_only_by'])) { + console.log(this.loggingPrefix_(), + 'local subjects can\'t have ACLs:', subject); reject(); return; } @@ -529,12 +533,13 @@ Cosmopolite.prototype.pin = function(subject, message) { var onSuccess = function() { this.pins_[id] = args; resolve(id); - } + }; if (subject['local']) { onSuccess.bind(this)(); - // Ugly hack, but we need this to promise to resolve before the callback fires. - // This is the equivalent of sched_yield(), and probably about as reliable. + // Ugly hack, but we need this to promise to resolve before the callback + // fires. This is the equivalent of sched_yield(), and probably about as + // reliable. window.setTimeout(this.onPin_.bind(this, Object.create(args)), 0); return; } diff --git a/static/test.js b/static/test.js index c920393..ffa05d8 100644 --- a/static/test.js +++ b/static/test.js @@ -660,7 +660,8 @@ QUnit.asyncTest('Local subject -- Message round trip', function(assert) { var cosmo = new Cosmopolite(null, randstring()); cosmo.addEventListener('message', function(e) { - assert.equal(e.detail['subject']['name'], subject['name'], 'subject matches'); + assert.equal(e.detail['subject']['name'], subject['name'], + 'subject matches'); assert.ok(e.detail['subject']['local'], 'subject still local'); assert.equal(e.detail['message'], message, 'message matches'); cosmo.shutdown();