B. js / Sesion.js

1import { CUE } from "./const/CUE.js"
2import { ROL_IDS } from "./const/ROL_IDS.js"
3
4export class Sesion {
5
6 /**
7 * @param { any } objeto
8 */
9 constructor(objeto) {
10
11 /** @readonly */
12 this.cue = objeto[CUE]
13 if (typeof this.cue !== "string")
14 throw new Error("cue debe ser string.")
15
16 /** @readonly */
17 const rolIds = objeto[ROL_IDS]
18 if (!Array.isArray(rolIds))
19 throw new Error("rolIds debe ser arreglo.")
20 /** @readonly */
21 this.rolIds = new Set(rolIds)
22
23 }
24
25}
26
27// Permite que los eventos de html usen la clase.
28window["Sesion"] = Sesion
skip_previous skip_next