Fix some lint errors from previous commit.
This commit is contained in:
@@ -290,8 +290,10 @@ Cosmopolite.prototype.subscribe = function(subjects, opt_messages, opt_lastID) {
|
|||||||
var subject = subjects[i];
|
var subject = subjects[i];
|
||||||
|
|
||||||
ret.push(this.newPromise_(function(resolve, reject) {
|
ret.push(this.newPromise_(function(resolve, reject) {
|
||||||
if (subject['local'] && (subject['readable_only_by'] || subject['writable_only_by'])) {
|
if (subject['local'] &&
|
||||||
console.log(this.loggingPrefix_(), 'local subjects can\'t have ACLs:', subject);
|
(subject['readable_only_by'] || subject['writable_only_by'])) {
|
||||||
|
console.log(this.loggingPrefix_(),
|
||||||
|
'local subjects can\'t have ACLs:', subject);
|
||||||
reject();
|
reject();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -407,8 +409,10 @@ Cosmopolite.prototype.unsubscribe = function(subject) {
|
|||||||
*/
|
*/
|
||||||
Cosmopolite.prototype.sendMessage = function(subject, message) {
|
Cosmopolite.prototype.sendMessage = function(subject, message) {
|
||||||
return this.newPromise_(function(resolve, reject) {
|
return this.newPromise_(function(resolve, reject) {
|
||||||
if (subject['local'] && (subject['readable_only_by'] || subject['writable_only_by'])) {
|
if (subject['local'] &&
|
||||||
console.log(this.loggingPrefix_(), 'local subjects can\'t have ACLs:', subject);
|
(subject['readable_only_by'] || subject['writable_only_by'])) {
|
||||||
|
console.log(this.loggingPrefix_(),
|
||||||
|
'local subjects can\'t have ACLs:', subject);
|
||||||
reject();
|
reject();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -529,12 +533,13 @@ Cosmopolite.prototype.pin = function(subject, message) {
|
|||||||
var onSuccess = function() {
|
var onSuccess = function() {
|
||||||
this.pins_[id] = args;
|
this.pins_[id] = args;
|
||||||
resolve(id);
|
resolve(id);
|
||||||
}
|
};
|
||||||
|
|
||||||
if (subject['local']) {
|
if (subject['local']) {
|
||||||
onSuccess.bind(this)();
|
onSuccess.bind(this)();
|
||||||
// Ugly hack, but we need this to promise to resolve before the callback fires.
|
// Ugly hack, but we need this to promise to resolve before the callback
|
||||||
// This is the equivalent of sched_yield(), and probably about as reliable.
|
// fires. This is the equivalent of sched_yield(), and probably about as
|
||||||
|
// reliable.
|
||||||
window.setTimeout(this.onPin_.bind(this, Object.create(args)), 0);
|
window.setTimeout(this.onPin_.bind(this, Object.create(args)), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -660,7 +660,8 @@ QUnit.asyncTest('Local subject -- Message round trip', function(assert) {
|
|||||||
var cosmo = new Cosmopolite(null, randstring());
|
var cosmo = new Cosmopolite(null, randstring());
|
||||||
|
|
||||||
cosmo.addEventListener('message', function(e) {
|
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.ok(e.detail['subject']['local'], 'subject still local');
|
||||||
assert.equal(e.detail['message'], message, 'message matches');
|
assert.equal(e.detail['message'], message, 'message matches');
|
||||||
cosmo.shutdown();
|
cosmo.shutdown();
|
||||||
|
|||||||
Reference in New Issue
Block a user