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

caleb531 / flip-book / 10498867251

21 Aug 2024 11:12PM UTC coverage: 26.973% (+0.1%) from 26.831%
10498867251

push

github

caleb531
Replace classnames utility with clsx

72 of 101 branches covered (71.29%)

Branch coverage included in aggregate %.

0 of 14 new or added lines in 7 files covered. (0.0%)

386 of 1597 relevant lines covered (24.17%)

3.64 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';
×
NEW
2
import clsx from 'clsx';
×
3
import { registerSW } from 'virtual:pwa-register';
×
4

5
class UpdateNotificationComponent {
×
6

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

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

31
  view() {
×
32
    return m('div.update-notification', {
×
NEW
33
      class: clsx({ 'update-available': this.isUpdateAvailable }),
×
34
      onclick: () => this.update()
×
35
    }, [
×
36
      m('span.update-notification-message', 'Update available! Click here to update.')
×
37
    ]);
×
38
  }
×
39

40
}
×
41

42
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