L. Carpeta « public / js »

Versión para imprimir.

1. public / js / nav-tab-fixed.js

1
import { resaltaSiEstasEn } from "../libclienteweb/resaltaSiEstasEn.js"
2
3
export class NavTabFixed extends HTMLElement {
4
5
 constructor() {
6
  super()
7
  this.creado = false
8
 }
9
10
 connectedCallback() {
11
  this.classList.add("md-tab", "fixed")
12
13
  if (!this.creado) {
14
15
   this.innerHTML = /* HTML */`
16
    <a ${resaltaSiEstasEn(["/index.html", "", "/"])} href="index.html">
17
     <span class="material-symbols-outlined">home</span>
18
     Inicio
19
    </a>
20
 
21
    <a ${resaltaSiEstasEn(["/select.html"])} href="select.html">
22
     <span class="material-symbols-outlined">bottom_panel_close</span>
23
     Select
24
    </a>
25
 
26
    <a ${resaltaSiEstasEn(["/ayuda.html"])} href="ayuda.html">
27
     <span class="material-symbols-outlined">help</span>
28
     Ayuda
29
    </a>`
30
31
   this.creado = true
32
33
  }
34
35
 }
36
37
}
38
39
customElements.define("nav-tab-fixed", NavTabFixed)

2. public / js / registraServiceWorker.js

1
const nombreDeServiceWorker = "sw.js"
2
3
try {
4
 navigator.serviceWorker.register(nombreDeServiceWorker)
5
  .then(registro => {
6
   console.log(nombreDeServiceWorker, "registrado.")
7
   console.log(registro)
8
  })
9
  .catch(error => console.log(error))
10
} catch (error) {
11
 console.log(error)
12
}