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

caleb531 / flip-book / 10499304652

22 Aug 2024 12:01AM UTC coverage: 27.382% (-0.2%) from 27.541%
10499304652

push

github

caleb531
Convert components to JSX

72 of 100 branches covered (72.0%)

Branch coverage included in aggregate %.

54 of 648 new or added lines in 27 files covered. (8.33%)

54 existing lines in 21 files now uncovered.

405 of 1642 relevant lines covered (24.67%)

8.88 hits per line

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

0.0
/scripts/components/update-notification.jsx
1
import m from 'mithril';
×
2
import clsx from 'clsx';
×
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
    }
×
12
    if (window.location.hostname === 'localhost' && !sessionStorage.getItem('sw')) {
×
13
      return;
×
14
    }
×
15
    this.isUpdateAvailable = false;
×
16
    this.updateSW = registerSW({
×
17
      onNeedRefresh: () => {
×
18
        this.isUpdateAvailable = true;
×
19
        m.redraw();
×
20
      }
×
21
    });
×
22
  }
×
23

24
  update() {
×
25
    if (this.updateSW) {
×
26
      this.updateSW();
×
27
    }
×
28
  }
×
29

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

44
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

© 2026 Coveralls, Inc