Skip to content

Commit

Permalink
Use random numbers instead of uuid.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVerborgh committed Oct 13, 2018
1 parent cbca647 commit c393f40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
"auth-header": "^1.0.0",
"@babel/runtime": "^7.0.0",
"commander": "^2.11.0",
"isomorphic-fetch": "^2.2.1",
"uuid": "^3.1.0"
"isomorphic-fetch": "^2.2.1"
},
"devDependencies": {
"@babel/cli": "^7.1.0",
Expand Down
8 changes: 4 additions & 4 deletions src/__test__/ipc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ describe('Client', () => {
expect(origin).toBe(parent.location.origin)
const request = data['solid-auth-client']
const { id, method, args } = request
expect(typeof id).toBe('string')
expect(id).toBeTruthy()
expect(method).toBe('foo')
expect(args).toEqual(['bar', 'baz'])
child.postMessage(
{
'solid-auth-client': {
id: request.id,
id,
ret: 'the return value!'
}
},
Expand Down Expand Up @@ -64,7 +64,7 @@ describe('Client', () => {
expect(origin).toBe(parent.location.origin)
const request = data['solid-auth-client']
const { id, method, args } = request
expect(typeof id).toBe('string')
expect(id).toBeTruthy()
expect(method).toBe('foo')
expect(args).toEqual(['bar', 'baz'])
child.postMessage(
Expand All @@ -79,7 +79,7 @@ describe('Client', () => {
child.postMessage(
{
'solid-auth-client': {
id: request.id,
id,
ret: 'the return value!'
}
},
Expand Down
7 changes: 3 additions & 4 deletions src/ipc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @flow
import uuid from 'uuid/v4'

/*
This module describes a simple IPC interface for communicating between browser windows.
Expand All @@ -8,15 +7,15 @@ import uuid from 'uuid/v4'
const request = {
'solid-auth-client': {
id: 'abcd-efgh-ijkl',
id: 1234,
method: 'doSomethingPlease',
args: [ 'one', 'two', 'three' ]
}
}
const response = {
'solid-auth-client': {
id: 'abcd-efgh-ijkl',
id: 1234,
ret: 'the_value'
}
}
Expand Down Expand Up @@ -87,7 +86,7 @@ export class Client {

request(method: string, ...args: any[]): Promise<any> {
// Send the request as a message to the server window
const id = uuid()
const id = Math.random()
this._serverWindow.postMessage(
{ [NAMESPACE]: { id, method, args } },
this._serverOrigin
Expand Down

0 comments on commit c393f40

Please sign in to comment.