We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@antfu what do you think about adding isSupported to useShare? This will break the current implementation.
export async function useShare(shareOpts: ShareOptions) { const _navigator = (window.navigator as NavigatorWithShare) const isSupported = _navigator && _navigator.share const share = () => { if (isSupported) { let granted = true if (shareOpts.files && _navigator.canShare) granted = _navigator.canShare({ files: shareOpts.files }) if (granted) return _navigator.share(shareOpts) } } return { isSupported, share, } }
Demo
<script> import { useShare } from '@vueuse/core' setup() { const { isSupported, share } = useShare({ title: 'Hello', text: 'Hello my friend!', url: location.href }) return { isSupported share, } }, </script> <div> <button @click="share" :disabled="!isSupported">Share</button> </div>
The text was updated successfully, but these errors were encountered:
Sure! You can make a PR on dev branch which we are aiming to introduce breaking changes altogether.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
@antfu what do you think about adding isSupported to useShare? This will break the current implementation.
Demo
The text was updated successfully, but these errors were encountered: