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(useTimeoutFn,useTimeout)!: rename type TimeoutOptions to UseTimeoutOptions and TimeoutFnOptions to UseTimeoutFnOptions #1944

Merged
merged 1 commit into from Jul 17, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions packages/core/useTimeoutPoll/index.ts
@@ -1,8 +1,8 @@
import { ref } from 'vue-demi'
import type { Awaitable, MaybeComputedRef, Pausable, TimeoutFnOptions } from '@vueuse/shared'
import type { Awaitable, MaybeComputedRef, Pausable, UseTimeoutFnOptions } from '@vueuse/shared'
import { tryOnScopeDispose, useTimeoutFn } from '@vueuse/shared'

export function useTimeoutPoll(fn: () => Awaitable<void>, interval: MaybeComputedRef<number>, timeoutPollOptions?: TimeoutFnOptions): Pausable {
export function useTimeoutPoll(fn: () => Awaitable<void>, interval: MaybeComputedRef<number>, timeoutPollOptions?: UseTimeoutFnOptions): Pausable {
const { start } = useTimeoutFn(loop, interval)

const isActive = ref(false)
Expand Down
10 changes: 5 additions & 5 deletions packages/shared/useTimeout/index.ts
@@ -1,11 +1,11 @@
import type { ComputedRef } from 'vue-demi'
import { computed } from 'vue-demi'
import type { TimeoutFnOptions } from '../useTimeoutFn'
import type { UseTimeoutFnOptions } from '../useTimeoutFn'
import { useTimeoutFn } from '../useTimeoutFn'
import type { Stoppable } from '../utils'
import { noop } from '../utils'

export interface TimeoutOptions<Controls extends boolean> extends TimeoutFnOptions {
export interface UseTimeoutOptions<Controls extends boolean> extends UseTimeoutFnOptions {
/**
* Expose more controls
*
Expand All @@ -21,9 +21,9 @@ export interface TimeoutOptions<Controls extends boolean> extends TimeoutFnOptio
* @param interval
* @param immediate
*/
export function useTimeout(interval?: number, options?: TimeoutOptions<false>): ComputedRef<boolean>
export function useTimeout(interval: number, options: TimeoutOptions<true>): { ready: ComputedRef<boolean> } & Stoppable
export function useTimeout(interval = 1000, options: TimeoutOptions<boolean> = {}) {
export function useTimeout(interval?: number, options?: UseTimeoutOptions<false>): ComputedRef<boolean>
export function useTimeout(interval: number, options: UseTimeoutOptions<true>): { ready: ComputedRef<boolean> } & Stoppable
export function useTimeout(interval = 1000, options: UseTimeoutOptions<boolean> = {}) {
const {
controls: exposeControls = false,
} = options
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/useTimeoutFn/index.ts
Expand Up @@ -5,7 +5,7 @@ import { tryOnScopeDispose } from '../tryOnScopeDispose'
import type { Stoppable } from '../utils'
import { isClient } from '../utils'

export interface TimeoutFnOptions {
export interface UseTimeoutFnOptions {
/**
* Start the timer immediate after calling this function
*
Expand All @@ -24,7 +24,7 @@ export interface TimeoutFnOptions {
export function useTimeoutFn(
cb: (...args: unknown[]) => any,
interval: MaybeComputedRef<number>,
options: TimeoutFnOptions = {},
options: UseTimeoutFnOptions = {},
): Stoppable {
const {
immediate = true,
Expand Down