|
@ -74,14 +74,14 @@ if (self.chrome) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!this.listenerId) { |
|
|
|
|
|
this.setup(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.channels[name] = { |
|
|
this.channels[name] = { |
|
|
portName: name, |
|
|
portName: name, |
|
|
listener: typeof callback === 'function' ? callback : null, |
|
|
listener: typeof callback === 'function' ? callback : null, |
|
|
send: function(message, callback) { |
|
|
send: function(message, callback) { |
|
|
|
|
|
if (!vAPI.messaging.listenerId) { |
|
|
|
|
|
vAPI.messaging.setup(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
message = { |
|
|
message = { |
|
|
portName: this.portName, |
|
|
portName: this.portName, |
|
|
msg: message |
|
|
msg: message |
|
@ -137,14 +137,14 @@ if (self.chrome) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!this._connector) { |
|
|
|
|
|
this.setup(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.channels[name] = { |
|
|
this.channels[name] = { |
|
|
portName: name, |
|
|
portName: name, |
|
|
listener: typeof callback === 'function' ? callback : null, |
|
|
listener: typeof callback === 'function' ? callback : null, |
|
|
send: function(message, callback) { |
|
|
send: function(message, callback) { |
|
|
|
|
|
if (!vAPI.messaging._connector) { |
|
|
|
|
|
vAPI.messaging.setup(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
message = { |
|
|
message = { |
|
|
portName: this.portName, |
|
|
portName: this.portName, |
|
|
msg: message |
|
|
msg: message |
|
|