File tree Expand file tree Collapse file tree 1 file changed +3
-16
lines changed Expand file tree Collapse file tree 1 file changed +3
-16
lines changed Original file line number Diff line number Diff line change @@ -75,31 +75,18 @@ export default class MessageBus {
75
75
* @template [T=unknown]
76
76
* @param {string } channel
77
77
* @param {string } topic
78
- * @param {T } [ payload]
78
+ * @param {T } payload
79
79
* @returns {Event<T> } Returns the {@link Event} object passed to subscribers.
80
80
*/
81
81
publish ( channel , topic , payload ) {
82
82
const event = new Event ( channel , topic , payload ) ;
83
83
this . ee . emit ( event . toKey ( ) , event ) ;
84
84
this . sink . push ( event ) ;
85
85
if ( this . bridge ) {
86
- /** @type {T | T[] } */
87
- let params = payload ;
88
-
89
- if ( typeof payload !== 'undefined' ) {
90
- // JSON RPC 2.0 requires that params is either an object or an array. Wrap primitives in an an array.
91
- const isPrimitive =
92
- typeof params === 'string' ||
93
- typeof params === 'boolean' ||
94
- typeof params === 'number' ;
95
- if ( isPrimitive ) {
96
- params = [ payload ] ;
97
- }
98
- }
99
86
100
87
this . bridge . notification ( {
101
88
method : `${ channel } /${ topic } ` ,
102
- params,
89
+ params : { "type" : typeof payload , payload } ,
103
90
} ) ;
104
91
}
105
92
return event ;
@@ -140,7 +127,7 @@ export default class MessageBus {
140
127
message
141
128
) ;
142
129
143
- const event = new Event ( channel , topic , request . params ) ;
130
+ const event = new Event ( channel , topic , request . params . payload ) ;
144
131
this . sink . push ( event ) ;
145
132
listener ( event ) ;
146
133
} ;
You can’t perform that action at this time.
0 commit comments