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

caleb531 / flip-book / 19905804943

03 Dec 2025 07:13PM UTC coverage: 74.679% (-13.5%) from 88.197%
19905804943

push

github

caleb531
Update all dependencies to latest

170 of 246 branches covered (69.11%)

Branch coverage included in aggregate %.

470 of 611 relevant lines covered (76.92%)

20.24 hits per line

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

20.0
/scripts/components/update-notification.jsx
1
import clsx from 'clsx';
2
import m from 'mithril';
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) {
4!
10
      return;
4✔
11
    }
12
    if (window.location.hostname === 'localhost' && !sessionStorage.getItem('sw')) {
×
13
      return;
×
14
    }
15
    this.isUpdateAvailable = false;
×
16
    this.isUpdating = 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.isUpdating = true;
×
28
      m.redraw();
×
29
      this.updateSW();
×
30
    }
31
  }
32

33
  view() {
34
    return (
38✔
35
      <div
36
        className={clsx('update-notification', {
37
          'update-available': this.isUpdateAvailable
38
        })}
39
        onclick={() => this.update()}
×
40
      >
41
        <span className="update-notification-message">
42
          {this.isUpdating ? 'Updating...' : 'Update available! Click here to update.'}
38!
43
        </span>
44
      </div>
45
    );
46
  }
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

© 2026 Coveralls, Inc