UNPKG

628 BJavaScriptView Raw
1import { UnavailabilityError } from '@unimodules/core';
2export default {
3 get name() {
4 return 'ExpoSharing';
5 },
6 async isAvailableAsync() {
7 if (typeof navigator === 'undefined') {
8 return false;
9 }
10 return !!navigator.share;
11 },
12 async shareAsync(url, options = {}) {
13 // NOTE: `navigator.share` is only available via HTTPS
14 if (navigator.share) {
15 await navigator.share({ ...options, url });
16 }
17 else {
18 throw new UnavailabilityError('navigator', 'share');
19 }
20 },
21};
22//# sourceMappingURL=ExpoSharing.web.js.map
\No newline at end of file