Skip to content

Commit 87e117b

Browse files
committed
registerRpc & createRpc
1 parent 90e7836 commit 87e117b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/api/createNodeFactory.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function createNodeFactory({ encode, decode }) {
2121
registerLocalRpcFromEncode,
2222
}
2323

24-
function registerLocalRpc(function_id, fn) {
24+
function registerRpc(function_id, fn) {
2525
local_rpcs_id[function_id] = fn
2626
local_rpcs.set(fn, function_id)
2727
return function_id
@@ -85,7 +85,7 @@ export default function createNodeFactory({ encode, decode }) {
8585

8686
function open(send, fn) {
8787
const function_id = 0
88-
if (isFunction(fn)) registerLocalRpc(function_id, fn)
88+
if (isFunction(fn)) registerRpc(function_id, fn)
8989
node.send = (msg) => send(serialize(msg))
9090
return createRemoteFunction({
9191
function_id,
@@ -157,14 +157,14 @@ export default function createNodeFactory({ encode, decode }) {
157157
}
158158

159159
function registerLocalRpcFromEncode(fn) {
160-
return registerLocalRpc(getNextLocalFunctionId(), fn)
160+
return registerRpc(getNextLocalFunctionId(), fn)
161161
}
162162

163163
const node = {
164164
open,
165165
message,
166166
requests,
167-
registerLocalRpc,
167+
registerRpc,
168168
createRpc,
169169
}
170170

test/createNode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,14 @@ test('rpcFilter API', async (t) => {
309309
objServer.login({ value: 2, fn: () => {} })
310310
})
311311

312-
test('registerLocalRpc & createRpc', async (t) => {
312+
test('registerRpc & createRpc', async (t) => {
313313
const server = createNode()
314314
const client = createNode()
315315
server.open(client.message)
316316
client.open(server.message)
317317

318318
const number = Math.random()
319-
server.registerLocalRpc('Login', (n) => {
319+
server.registerRpc('Login', (n) => {
320320
t.is(n, number)
321321
return n + 1
322322
})

0 commit comments

Comments
 (0)