Catch `navigator.share` errors with a no-op

This commit is contained in:
Andreas Nedbal 2023-10-18 20:04:41 +02:00
parent bc45bda517
commit 7156dc5c9b
1 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import { Controller } from '@hotwired/stimulus'; import { Controller } from '@hotwired/stimulus';
import noop from 'utilities/noop';
export default class extends Controller { export default class extends Controller {
static values = { static values = {
@ -35,8 +36,10 @@ export default class extends Controller {
}; };
} }
navigator.share(shareConfiguration).then(() => { navigator.share(shareConfiguration)
this.element.dispatchEvent(new CustomEvent('retrospring:shared')); .then(() => {
}); this.element.dispatchEvent(new CustomEvent('retrospring:shared'));
})
.catch(noop);
} }
} }