File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed
Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -317,23 +317,6 @@ export function notify(name: string, args: any) {
317317 window . parent . postMessage ( payload , "*" ) ;
318318}
319319
320- function generateUUID ( ) {
321- const buf = new Uint8Array ( 16 ) ;
322- crypto . getRandomValues ( buf ) ;
323-
324- buf [ 6 ] = ( buf [ 6 ] & 0x0f ) | 0x40 ; // version 4
325- buf [ 8 ] = ( buf [ 8 ] & 0x3f ) | 0x80 ; // variant
326-
327- const hex = Array . from ( buf , ( b ) => b . toString ( 16 ) . padStart ( 2 , "0" ) ) . join ( "" ) ;
328-
329- return [
330- hex . substring ( 0 , 8 ) ,
331- hex . substring ( 8 , 12 ) ,
332- hex . substring ( 12 , 16 ) ,
333- hex . substring ( 16 , 20 ) ,
334- hex . substring ( 20 ) ,
335- ] . join ( "-" ) ;
336- }
337320export function addNotificationListener (
338321 name : "tablesChanged" ,
339322 handler : ( ) => void ,
@@ -454,3 +437,21 @@ window.addEventListener("message", (event) => {
454437 }
455438} ) ;
456439
440+ function generateUUID ( ) {
441+ const buf = new Uint8Array ( 16 ) ;
442+ crypto . getRandomValues ( buf ) ;
443+
444+ buf [ 6 ] = ( buf [ 6 ] & 0x0f ) | 0x40 ; // version 4
445+ buf [ 8 ] = ( buf [ 8 ] & 0x3f ) | 0x80 ; // variant
446+
447+ const hex = Array . from ( buf , ( b ) => b . toString ( 16 ) . padStart ( 2 , "0" ) ) . join ( "" ) ;
448+
449+ return [
450+ hex . substring ( 0 , 8 ) ,
451+ hex . substring ( 8 , 12 ) ,
452+ hex . substring ( 12 , 16 ) ,
453+ hex . substring ( 16 , 20 ) ,
454+ hex . substring ( 20 ) ,
455+ ] . join ( "-" ) ;
456+ }
457+
You can’t perform that action at this time.
0 commit comments