File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ import { NoopConnectivityMonitor } from '../remote/connectivity_monitor_noop';
25
25
import { BrowserConnectivityMonitor } from './browser_connectivity_monitor' ;
26
26
import { WebChannelConnection } from './webchannel_connection' ;
27
27
28
+ // Polyfill for IE
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ const crypto = window . crypto || ( window as any ) . msCrypto ;
31
+
28
32
export class BrowserPlatform implements Platform {
29
33
readonly useProto3Json = true ;
30
34
readonly base64Available : boolean ;
Original file line number Diff line number Diff line change @@ -31,15 +31,15 @@ export class AutoId {
31
31
let autoId = '' ;
32
32
while ( autoId . length < 20 ) {
33
33
const bytes = PlatformSupport . getPlatform ( ) . randomBytes ( 40 ) ;
34
- bytes . forEach ( b => {
34
+ for ( const b of Array . from ( bytes ) ) {
35
35
// Length of `chars` is 62. We only take bytes between 0 and 62*4-1
36
36
// (both inclusive). The value is then evenly mapped to indices of `char`
37
37
// via a modulo operation.
38
38
const maxValue = 62 * 4 - 1 ;
39
39
if ( autoId . length < 20 && b <= maxValue ) {
40
40
autoId += chars . charAt ( b % 62 ) ;
41
41
}
42
- } ) ;
42
+ }
43
43
}
44
44
assert ( autoId . length === 20 , 'Invalid auto ID: ' + autoId ) ;
45
45
return autoId ;
You can’t perform that action at this time.
0 commit comments