Skip to content

Commit cb6134d

Browse files
committed
bump version
1 parent fd6d109 commit cb6134d

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

dist/bundle.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const transports = require('./transports');
55
function rawr({ transport, timeout = 0, handlers = {}, methods, idGenerator }) {
66
let callId = 0;
77
// eslint-disable-next-line no-param-reassign
8-
methods = methods || handlers; // backwards compat
8+
methods = methods || handlers || {}; // backwards compat
99
const pendingCalls = {};
1010
const methodHandlers = {};
1111
const notificationEvents = new EventEmitter();
@@ -112,6 +112,8 @@ function rawr({ transport, timeout = 0, handlers = {}, methods, idGenerator }) {
112112
const testArg = args.pop();
113113
if (testArg && typeof testArg === 'object' && !Array.isArray(testArg)) {
114114
config = testArg;
115+
} else {
116+
args.push(testArg);
115117
}
116118
}
117119
return sendMessage(name, args, config || {});
@@ -133,6 +135,28 @@ function rawr({ transport, timeout = 0, handlers = {}, methods, idGenerator }) {
133135
}
134136
});
135137

138+
const configurableNotifiersProxy = new Proxy({}, {
139+
get: (target, name) => {
140+
return (...args) => {
141+
let config;
142+
if (args.length) {
143+
const testArg = args.pop();
144+
if (testArg && typeof testArg === 'object' && !Array.isArray(testArg)) {
145+
config = testArg;
146+
} else {
147+
args.push(testArg);
148+
}
149+
}
150+
const msg = {
151+
jsonrpc: '2.0',
152+
method: name,
153+
params: args
154+
};
155+
transport.send(msg, config || {});
156+
};
157+
}
158+
});
159+
136160
const notifications = new Proxy({}, {
137161
get: (target, name) => {
138162
return (callback) => {
@@ -149,6 +173,7 @@ function rawr({ transport, timeout = 0, handlers = {}, methods, idGenerator }) {
149173
addHandler,
150174
notifications,
151175
notifiers,
176+
notifiersExt: configurableNotifiersProxy,
152177
transport,
153178
};
154179
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rawr",
3-
"version": "0.17.0",
3+
"version": "0.18.0",
44
"description": "JSON-RPC over simple node style event emitters",
55
"dependencies": {
66
"eventemitter3": "^5.0.1"

0 commit comments

Comments
 (0)