Skip to content

Commit 1be8aa3

Browse files
committed
move guidGenerator to utils to make it more available
1 parent 9d0837a commit 1be8aa3

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

pyscriptjs/src/components/base.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { pyodideLoaded, loadedEnvironments, componentDetailsNavOpen, mode } from '../stores';
2-
2+
import { guidGenerator } from '../utils';
33
// Premise used to connect to the first available pyodide interpreter
44
let pyodideReadyPromise;
55
let environments;
@@ -27,13 +27,6 @@ type PyodideInterface = {
2727
registerJsModule(name: string, module: object): void
2828
}
2929

30-
export function guidGenerator(): string {
31-
var S4 = function(): string {
32-
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
33-
};
34-
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
35-
}
36-
3730
export class BaseEvalElement extends HTMLElement {
3831
shadow: ShadowRoot;
3932
wrapper: HTMLElement;

pyscriptjs/src/utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,11 @@ function ltrim(code: string): string {
3434
return code
3535
}
3636

37-
export {addClasses, getLastPath, ltrim, htmlDecode}
37+
function guidGenerator(): string {
38+
var S4 = function(): string {
39+
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
40+
};
41+
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
42+
}
43+
44+
export {addClasses, getLastPath, ltrim, htmlDecode, guidGenerator}

0 commit comments

Comments
 (0)