Skip to content
New issue

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

fix(useShare)!: rename type ShareOptions to UseShareOptions #1888

Merged
merged 1 commit into from Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/core/useShare/index.ts
Expand Up @@ -4,16 +4,16 @@ import { useSupported } from '../useSupported'
import type { ConfigurableNavigator } from '../_configurable'
import { defaultNavigator } from '../_configurable'

export interface ShareOptions {
export interface UseShareOptions {
title?: string
files?: File[]
text?: string
url?: string
}

interface NavigatorWithShare {
share?: (data: ShareOptions) => Promise<void>
canShare?: (data: ShareOptions) => boolean
share?: (data: UseShareOptions) => Promise<void>
canShare?: (data: UseShareOptions) => boolean
}

/**
Expand All @@ -23,13 +23,13 @@ interface NavigatorWithShare {
* @param shareOptions
* @param options
*/
export function useShare(shareOptions: MaybeComputedRef<ShareOptions> = {}, options: ConfigurableNavigator = {}) {
export function useShare(shareOptions: MaybeComputedRef<UseShareOptions> = {}, options: ConfigurableNavigator = {}) {
const { navigator = defaultNavigator } = options

const _navigator = (navigator as NavigatorWithShare)
const isSupported = useSupported(() => _navigator && 'canShare' in _navigator)

const share = async (overrideOptions: MaybeComputedRef<ShareOptions> = {}) => {
const share = async (overrideOptions: MaybeComputedRef<UseShareOptions> = {}) => {
if (isSupported.value) {
const data = {
...resolveUnref(shareOptions),
Expand Down