Code styling

pull/2/head
Deathamns 10 years ago committed by gorhill
parent 5ec2e067df
commit 3d40e0b2aa

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

Loading…
Cancel
Save