• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

caleb531 / flip-book / 10499286139

21 Aug 2024 11:59PM UTC coverage: 25.53% (-2.0%) from 27.541%
10499286139

push

github

caleb531
Convert components to JSX

72 of 100 branches covered (72.0%)

Branch coverage included in aggregate %.

0 of 743 new or added lines in 22 files covered. (0.0%)

54 existing lines in 21 files now uncovered.

386 of 1694 relevant lines covered (22.79%)

6.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/scripts/components/update-notification.jsx
NEW
1
import m from "mithril";
×
NEW
2
import clsx from "clsx";
×
NEW
3
import { registerSW } from "virtual:pwa-register";
×
4

5
class UpdateNotificationComponent {
×
6
  // Use Vite PWA plugin to manage service worker updates (source:
7
  // <https://vite-pwa-org.netlify.app/guide/prompt-for-update.html#importing-virtual-modules>)
8
  oninit() {
×
9
    if (!navigator.serviceWorker) {
×
10
      return;
×
11
    }
×
NEW
12
    if (
×
NEW
13
      window.location.hostname === "localhost" &&
×
NEW
14
      !sessionStorage.getItem("sw")
×
NEW
15
    ) {
×
16
      return;
×
17
    }
×
18
    this.isUpdateAvailable = false;
×
19
    this.updateSW = registerSW({
×
20
      onNeedRefresh: () => {
×
21
        this.isUpdateAvailable = true;
×
22
        m.redraw();
×
NEW
23
      },
×
24
    });
×
25
  }
×
26

27
  update() {
×
28
    if (this.updateSW) {
×
29
      this.updateSW();
×
30
    }
×
31
  }
×
32

33
  view() {
×
NEW
34
    return (
×
NEW
35
      <div
×
NEW
36
        className={clsx("update-notification", {
×
NEW
37
          "update-available": this.isUpdateAvailable,
×
NEW
38
        })}
×
NEW
39
        onclick={() => this.update()}
×
40
      >
NEW
41
        <span className="update-notification-message">
×
42
          Update available! Click here to update.
NEW
43
        </span>
×
NEW
44
      </div>
×
45
    );
UNCOV
46
  }
×
UNCOV
47
}
×
48

49
export default UpdateNotificationComponent;
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc