mirror of
https://github.com/Hopiu/postal.js.git
synced 2026-03-16 22:20:23 +00:00
Fixed potential bug in publishing from ChannelDefinition
This commit is contained in:
parent
c0b1d21a2b
commit
fea0ddf952
2 changed files with 6 additions and 2 deletions
|
|
@ -67,7 +67,9 @@
|
|||
};
|
||||
|
||||
ChannelDefinition.prototype.publish = function () {
|
||||
var envelope = arguments.length === 1 ? arguments[0] : { topic : arguments[0], data : arguments[1] };
|
||||
var envelope = arguments.length === 1 ?
|
||||
(Object.prototype.toString.call(arguments[0]) === '[object String]' ?
|
||||
arguments[0] : { topic: arguments[0] }) : { topic : arguments[0], data : arguments[1] };
|
||||
envelope.channel = this.channel;
|
||||
return postal.configuration.bus.publish( envelope );
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ ChannelDefinition.prototype.subscribe = function () {
|
|||
};
|
||||
|
||||
ChannelDefinition.prototype.publish = function () {
|
||||
var envelope = arguments.length === 1 ? arguments[0] : { topic : arguments[0], data : arguments[1] };
|
||||
var envelope = arguments.length === 1 ?
|
||||
(Object.prototype.toString.call(arguments[0]) === '[object String]' ?
|
||||
arguments[0] : { topic: arguments[0] }) : { topic : arguments[0], data : arguments[1] };
|
||||
envelope.channel = this.channel;
|
||||
return postal.configuration.bus.publish( envelope );
|
||||
};
|
||||
Loading…
Reference in a new issue