pusher-js 8.0.0 → 8.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pusher-js",
3
- "version": "8.0.0",
3
+ "version": "8.0.2",
4
4
  "description": "Pusher Channels JavaScript library for browsers, React Native, NodeJS and web workers",
5
5
  "main": "dist/node/pusher.js",
6
6
  "browser": "dist/web/pusher.js",
@@ -4,7 +4,6 @@ import { Network } from './net_info';
4
4
  import xhrAuth from 'isomorphic/auth/xhr_auth';
5
5
  import { AuthTransports } from 'core/auth/auth_transports';
6
6
  import xhrTimeline from 'isomorphic/timeline/xhr_timeline';
7
- import { randomInt } from 'crypto';
8
7
 
9
8
  // Very verbose but until unavoidable until
10
9
  // TypeScript 2.1, when spread attributes will be
@@ -59,7 +58,7 @@ const ReactNative: Runtime = {
59
58
  },
60
59
 
61
60
  randomInt(max: number): number {
62
- return randomInt(max);
61
+ return Math.floor(Math.random() * max);
63
62
  }
64
63
  };
65
64
 
@@ -45,7 +45,7 @@ var fetchAuth: AuthTransport = function(
45
45
  return response.text();
46
46
  }
47
47
  throw new HTTPAuthError(
48
- 200,
48
+ status,
49
49
  `Could not get ${authRequestType.toString()} info from your auth endpoint, status: ${status}`
50
50
  );
51
51
  })
@@ -62,7 +62,7 @@ const Worker: Runtime = {
62
62
  * Return values in the range of [0, 1[
63
63
  */
64
64
  const random = function() {
65
- const crypto = window.crypto || window['msCrypto'];
65
+ const crypto = globalThis.crypto || globalThis['msCrypto'];
66
66
  const random = crypto.getRandomValues(new Uint32Array(1))[0];
67
67
 
68
68
  return random / 2 ** 32;
@@ -29,7 +29,7 @@ module.exports = merge({}, configShared, {
29
29
  RUNTIME: JSON.stringify('react-native')
30
30
  }),
31
31
  new webpack.ProvidePlugin({
32
- buffer: 'buffer'
32
+ Buffer: ['buffer', 'Buffer']
33
33
  })
34
34
  ]
35
35
  });