Retrospring/app/javascript/retrospring/controllers/capabilities_controller.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
460 B
TypeScript
Raw Normal View History

2023-01-16 20:45:12 -08:00
import { Controller } from '@hotwired/stimulus';
export default class extends Controller {
connect(): void {
const capabilities = [];
if ('share' in navigator) {
capabilities.push('cap-web-share');
}
if ('serviceWorker' in navigator) {
capabilities.push('cap-service-worker');
}
if ('Notification' in window) {
capabilities.push('cap-notification');
}
this.element.classList.add(...capabilities);
}
}