Skip to content

Commit c393f40

Browse files
committed
Use random numbers instead of uuid.
1 parent cbca647 commit c393f40

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
"auth-header": "^1.0.0",
5353
"@babel/runtime": "^7.0.0",
5454
"commander": "^2.11.0",
55-
"isomorphic-fetch": "^2.2.1",
56-
"uuid": "^3.1.0"
55+
"isomorphic-fetch": "^2.2.1"
5756
},
5857
"devDependencies": {
5958
"@babel/cli": "^7.1.0",

src/__test__/ipc.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ describe('Client', () => {
2727
expect(origin).toBe(parent.location.origin)
2828
const request = data['solid-auth-client']
2929
const { id, method, args } = request
30-
expect(typeof id).toBe('string')
30+
expect(id).toBeTruthy()
3131
expect(method).toBe('foo')
3232
expect(args).toEqual(['bar', 'baz'])
3333
child.postMessage(
3434
{
3535
'solid-auth-client': {
36-
id: request.id,
36+
id,
3737
ret: 'the return value!'
3838
}
3939
},
@@ -64,7 +64,7 @@ describe('Client', () => {
6464
expect(origin).toBe(parent.location.origin)
6565
const request = data['solid-auth-client']
6666
const { id, method, args } = request
67-
expect(typeof id).toBe('string')
67+
expect(id).toBeTruthy()
6868
expect(method).toBe('foo')
6969
expect(args).toEqual(['bar', 'baz'])
7070
child.postMessage(
@@ -79,7 +79,7 @@ describe('Client', () => {
7979
child.postMessage(
8080
{
8181
'solid-auth-client': {
82-
id: request.id,
82+
id,
8383
ret: 'the return value!'
8484
}
8585
},

src/ipc.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// @flow
2-
import uuid from 'uuid/v4'
32

43
/*
54
This module describes a simple IPC interface for communicating between browser windows.
@@ -8,15 +7,15 @@ import uuid from 'uuid/v4'
87
98
const request = {
109
'solid-auth-client': {
11-
id: 'abcd-efgh-ijkl',
10+
id: 1234,
1211
method: 'doSomethingPlease',
1312
args: [ 'one', 'two', 'three' ]
1413
}
1514
}
1615
1716
const response = {
1817
'solid-auth-client': {
19-
id: 'abcd-efgh-ijkl',
18+
id: 1234,
2019
ret: 'the_value'
2120
}
2221
}
@@ -87,7 +86,7 @@ export class Client {
8786

8887
request(method: string, ...args: any[]): Promise<any> {
8988
// Send the request as a message to the server window
90-
const id = uuid()
89+
const id = Math.random()
9190
this._serverWindow.postMessage(
9291
{ [NAMESPACE]: { id, method, args } },
9392
this._serverOrigin

0 commit comments

Comments
 (0)