Modularize createUUID.
parent
3231f4248a
commit
ca640e39da
|
|
@ -0,0 +1,9 @@
|
|||
// Taken from http://stackoverflow.com/a/105074/515584
|
||||
// Strictly speaking, it's not a real UUID, but it gets the job done here
|
||||
export function createUUID() {
|
||||
function s4() {
|
||||
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
||||
}
|
||||
|
||||
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { dataChannelConfig, peerConnectionConfig } from './config.js';
|
||||
import { createUUID } from './random.js';
|
||||
|
||||
var localVideo;
|
||||
var localStream;
|
||||
|
|
@ -113,14 +114,4 @@ function errorHandler(error) {
|
|||
console.log(error);
|
||||
}
|
||||
|
||||
// Taken from http://stackoverflow.com/a/105074/515584
|
||||
// Strictly speaking, it's not a real UUID, but it gets the job done here
|
||||
function createUUID() {
|
||||
function s4() {
|
||||
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
||||
}
|
||||
|
||||
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
||||
}
|
||||
|
||||
pageReady();
|
||||
|
|
|
|||
Loading…
Reference in New Issue