explore: generate session id
This commit is contained in:
parent
97b0629de0
commit
3c859c0931
1 changed files with 18 additions and 1 deletions
|
@ -37,6 +37,15 @@ export const pvapp = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// components
|
||||||
|
|
||||||
|
function Data() {
|
||||||
|
return {
|
||||||
|
data: {},
|
||||||
|
save
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// appdata method definitions
|
// appdata method definitions
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
@ -52,7 +61,15 @@ function poll() {
|
||||||
dopoll(this)
|
dopoll(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
// basic functions
|
// basic functions - move to api.ts
|
||||||
|
|
||||||
|
function createSid(): string {
|
||||||
|
const arr = new Uint32Array(2)
|
||||||
|
crypto.getRandomValues(arr)
|
||||||
|
return arr[0].toString(36) + arr[1].toString(36)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("sid: ", createSid())
|
||||||
|
|
||||||
async function dopoll(app: typeof appdata) {
|
async function dopoll(app: typeof appdata) {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue