|
|
@ -55,7 +55,7 @@ var messagingConnector = function(response) { |
|
|
|
var channels = vAPI.messaging.channels; |
|
|
|
var channel, listener; |
|
|
|
|
|
|
|
if ( response.broadcast === true && !response.portName ) { |
|
|
|
if ( response.broadcast === true && !response.channelName ) { |
|
|
|
for ( channel in channels ) { |
|
|
|
if ( channels.hasOwnProperty(channel) === false ) { |
|
|
|
continue; |
|
|
@ -75,7 +75,7 @@ var messagingConnector = function(response) { |
|
|
|
} |
|
|
|
|
|
|
|
if ( !listener ) { |
|
|
|
channel = channels[response.portName]; |
|
|
|
channel = channels[response.channelName]; |
|
|
|
listener = channel && channel.listener; |
|
|
|
} |
|
|
|
|
|
|
@ -121,7 +121,7 @@ vAPI.messaging = { |
|
|
|
} |
|
|
|
|
|
|
|
this.channels[channelName] = { |
|
|
|
portName: channelName, |
|
|
|
channelName: channelName, |
|
|
|
listener: typeof callback === 'function' ? callback : null, |
|
|
|
send: function(message, callback) { |
|
|
|
if ( vAPI.messaging.port === null ) { |
|
|
@ -129,7 +129,7 @@ vAPI.messaging = { |
|
|
|
} |
|
|
|
|
|
|
|
message = { |
|
|
|
portName: this.portName, |
|
|
|
channelName: this.channelName, |
|
|
|
msg: message |
|
|
|
}; |
|
|
|
|
|
|
@ -141,7 +141,7 @@ vAPI.messaging = { |
|
|
|
vAPI.messaging.port.postMessage(message); |
|
|
|
}, |
|
|
|
close: function() { |
|
|
|
delete vAPI.messaging.channels[this.portName]; |
|
|
|
delete vAPI.messaging.channels[this.channelName]; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|