Skip to content

Commit

Permalink
docs: update categories
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 24, 2022
1 parent d53f30f commit 616591b
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 77 deletions.
2 changes: 1 addition & 1 deletion packages/core/useTimeAgo/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
category: Misc
category: Time
---

# useTimeAgo
Expand Down
2 changes: 1 addition & 1 deletion packages/core/useWebWorker/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
category: Misc
category: Browser
related: useWebWorkerFn
---

Expand Down
2 changes: 1 addition & 1 deletion packages/core/useWebWorkerFn/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
category: Misc
category: Browser
---

# useWebWorkerFn
Expand Down
38 changes: 1 addition & 37 deletions packages/electron/useIpcRenderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,41 @@ import { useIpcRendererOn } from '../useIpcRendererOn'
* Result from useIpcRenderer
*
* @see https://www.electronjs.org/docs/api/ipc-renderer
* @export
* @interface UseIpcRendererReturn
*/
export interface UseIpcRendererReturn {
/**
* Listens to channel, when a new message arrives listener would be called with listener(event, args...).
* [ipcRenderer.removeListener](https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererremovelistenerchannel-listener) automatically on unmounted.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendereronchannel-listener
* @param {string} channel
* @param {IpcRendererListener} listener
* @returns {IpcRenderer}
*/
on(channel: string, listener: IpcRendererListener): IpcRenderer

/**
* Adds a one time listener function for the event. This listener is invoked only the next time a message is sent to channel, after which it is removed.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendereroncechannel-listener
* @param {string} channel
* @param {(event: IpcRendererEvent, ...args: any[]) => void} listener
* @returns {IpcRenderer}
*/
once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): IpcRenderer

/**
* Removes the specified listener from the listener array for the specified channel.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererremovelistenerchannel-listener
* @param {string} channel
* @param {(...args: any[]) => void} listener
* @returns {IpcRenderer}
*/
removeListener(channel: string, listener: (...args: any[]) => void): IpcRenderer

/**
* Removes all listeners, or those of the specified channel.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererremovealllistenerschannel
* @param {string} channel
* @returns {IpcRenderer}
*/
removeAllListeners(channel: string): IpcRenderer

/**
* Send an asynchronous message to the main process via channel, along with arguments.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrenderersendchannel-args
* @param {string} channel
* @param {...any[]} args
*/
send(channel: string, ...args: any[]): void

Expand All @@ -68,10 +53,6 @@ export interface UseIpcRendererReturn {
* As composition-api, it makes asynchronous operations look like synchronous.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererinvokechannel-args
* @template T
* @param {string} channel
* @param {...any[]} args
* @returns {(Ref<T | null>)}
*/
invoke<T>(channel: string, ...args: any[]): Ref<T | null>

Expand All @@ -80,48 +61,33 @@ export interface UseIpcRendererReturn {
* Send a message to the main process via channel and expect a result synchronously.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrenderersendsyncchannel-args
* @template T
* @param {string} channel
* @param {...any[]} args
* @returns {(Ref<T | null>)}
*/
sendSync<T>(channel: string, ...args: any[]): Ref<T | null>

/**
* Send a message to the main process, optionally transferring ownership of zero or more MessagePort objects.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer
* @param {string} channel
* @param {*} message
* @param {MessagePort[]} [transfer]
*/
postMessage(channel: string, message: any, transfer?: MessagePort[]): void

/**
* Sends a message to a window with webContentsId via channel.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrenderersendtowebcontentsid-channel-args
* @param {number} webContentsId
* @param {string} channel
* @param {...any[]} args
*/
sendTo(webContentsId: number, channel: string, ...args: any[]): void

/**
* Like ipcRenderer.send but the event will be sent to the <webview> element in the host page instead of the main process.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrenderersendtohostchannel-args
* @param {string} channel
* @param {...any[]} args
*/
sendToHost(channel: string, ...args: any[]): void
}

/**
* Create a `sendSync` function
*
* @param {IpcRenderer} ipcRenderer
* @returns
*/
function setSendSync(ipcRenderer: IpcRenderer) {
return <T>(channel: string, ...args: any[]) => {
Expand All @@ -135,9 +101,7 @@ function setSendSync(ipcRenderer: IpcRenderer) {
* Get the `ipcRenderer` module with all APIs.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrenderersendtohostchannel-args
* @export
* @param {IpcRenderer} [ipcRenderer]
* @returns {UseIpcRendererReturn}
* @see https://vueuse.org/useIpcRenderer
*/
export function useIpcRenderer(ipcRenderer?: IpcRenderer): UseIpcRendererReturn {
if (!ipcRenderer)
Expand Down
13 changes: 2 additions & 11 deletions packages/electron/useIpcRendererInvoke/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ import { shallowRef } from 'vue-demi'
* You need to provide `ipcRenderer` to this function.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererinvokechannel-args
* @export
* @template T
* @param {IpcRenderer} ipcRenderer
* @param {string} channel
* @param {...any[]} args
* @returns {(Ref<T | null>)}
* @see https://vueuse.org/useIpcRendererInvoke
*/
export function useIpcRendererInvoke<T>(ipcRenderer: IpcRenderer, channel: string, ...args: any[]): Ref<T | null>

Expand All @@ -28,11 +23,7 @@ export function useIpcRendererInvoke<T>(ipcRenderer: IpcRenderer, channel: strin
* `ipcRenderer` will be automatically gotten.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendererinvokechannel-args
* @export
* @template T
* @param {string} channel
* @param {...any[]} args
* @returns {(Ref<T | null>)}
* @see https://vueuse.org/useIpcRendererInvoke
*/
export function useIpcRendererInvoke<T>(channel: string, ...args: any[]): Ref<T | null>

Expand Down
11 changes: 2 additions & 9 deletions packages/electron/useIpcRendererOn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import type { IpcRendererListener } from '../_types'
* You need to provide `ipcRenderer` to this function.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendereronchannel-listener
* @export
* @param {IpcRenderer} ipcRenderer
* @param {string} channel
* @param {IpcRendererListener} listener
* @returns {IpcRenderer}
* @see https://vueuse.org/useIpcRendererOn
*/
export function useIpcRendererOn(ipcRenderer: IpcRenderer, channel: string, listener: IpcRendererListener): IpcRenderer

Expand All @@ -24,10 +20,7 @@ export function useIpcRendererOn(ipcRenderer: IpcRenderer, channel: string, list
* `ipcRenderer` will be automatically gotten.
*
* @see https://www.electronjs.org/docs/api/ipc-renderer#ipcrendereronchannel-listener
* @export
* @param {string} channel
* @param {IpcRendererListener} listener
* @returns {IpcRenderer}
* @see https://vueuse.org/useIpcRendererOn
*/
export function useIpcRendererOn(channel: string, listener: IpcRendererListener): IpcRenderer

Expand Down
4 changes: 1 addition & 3 deletions packages/electron/useZoomFactor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export function useZoomFactor(): Ref<number>
* Reactive WebFrame zoom factor
*
* @see https://www.electronjs.org/docs/api/web-frame#webframesetzoomfactorfactor
* @export
* @param {WebFrame} [webFrame]
* @returns {Ref<number>}
* @see https://vueuse.org/useZoomFactor
*/
export function useZoomFactor(...args: any[]): Ref<number> {
let webFrame: WebFrame | undefined
Expand Down
4 changes: 1 addition & 3 deletions packages/electron/useZoomLevel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export function useZoomLevel(): Ref<number>
* Reactive WebFrame zoom level
*
* @see https://www.electronjs.org/docs/api/web-frame#webframesetzoomlevellevel
* @export
* @param {WebFrame} [webFrame]
* @returns {Ref<number>}
* @see https://vueuse.org/useZoomLevel
*/
export function useZoomLevel(...args: any[]): Ref<number> {
let webFrame: WebFrame | undefined
Expand Down
5 changes: 5 additions & 0 deletions packages/firebase/useAuth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export interface UseFirebaseAuthOptions {
user: Ref<User | null>
}

/**
* Reactive Firebase Auth binding
*
* @see https://vueuse.org/useAuth
*/
export function useAuth(auth: Auth) {
const user = ref<User | null>(auth.currentUser)
const isAuthenticated = computed(() => !!user.value)
Expand Down
3 changes: 0 additions & 3 deletions packages/firebase/useFirestore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ export function useFirestore<T extends DocumentData>(
* local data in sync with remotes databases.
*
* @see https://vueuse.org/useFirestore
* @param docRef
* @param initialValue
* @param options
*/
export function useFirestore<T extends DocumentData>(
docRef: FirebaseDocRef<T>,
Expand Down
3 changes: 1 addition & 2 deletions packages/firebase/useRTDB/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export interface UseRTDBOptions {
/**
* Reactive Firebase Realtime Database binding.
*
* @param docRef
* @param options
* @see https://vueuse.org/useRTDB
*/
export function useRTDB<T = any>(
docRef: DatabaseReference,
Expand Down
2 changes: 1 addition & 1 deletion packages/metadata/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const categoriesOrder = [
'Watch',
'Reactivity',
'Array',
'Time',
'Utilities',
'Misc',
]

export const metadata = _metadata as PackageIndexes
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/reactiveOmit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { reactiveComputed } from '../reactiveComputed'
/**
* Reactively omit fields from a reactive object
*
* @see https://vueuse.js.org/reactiveOmit
* @see https://vueuse.org/reactiveOmit
*/
export function reactiveOmit<T extends object, K extends keyof T>(
obj: T,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/reactivePick/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { reactive, toRef } from 'vue-demi'
/**
* Reactively pick fields from a reactive object
*
* @see https://vueuse.js.org/reactivePick
* @see https://vueuse.org/reactivePick
*/
export function reactivePick<T extends object, K extends keyof T>(
obj: T,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/useDateFormat/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
category: Utilities
category: Time
---

# useDateFormat
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/useDebounceFn/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { MaybeComputedRef } from '@vueuse/shared'
import type { DebounceFilterOptions, FunctionArgs } from '../utils'
import { createFilterWrapper, debounceFilter } from '../utils'

/**
* Debounce execution of a function.
*
* @see https://vueuse.org/useDebounceFn
* @param fn A function to be executed after delay milliseconds debounced.
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param opts options
Expand Down
5 changes: 5 additions & 0 deletions packages/shared/useInterval/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export interface UseIntervalOptions<Controls extends boolean> {
immediate?: boolean
}

/**
* Reactive counter increases on every interval
*
* @see https://vueuse.org/useInterval
*/
export function useInterval(interval?: MaybeComputedRef<number>, options?: UseIntervalOptions<false>): Ref<number>
export function useInterval(interval: MaybeComputedRef<number>, options: UseIntervalOptions<true>): { counter: Ref<number> } & Pausable
export function useInterval(interval: MaybeComputedRef<number> = 1000, options: UseIntervalOptions<boolean> = {}) {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/useLastChanged/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
category: Utilities
category: State
---

# useLastChanged
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/whenever/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { watch } from 'vue-demi'
/**
* Shorthand for watching value to be truthy
*
* @see https://vueuse.js.org/whenever
* @see https://vueuse.org/whenever
*/
export function whenever<T>(source: WatchSource<T | false | null | undefined>, cb: WatchCallback<T>, options?: WatchOptions) {
return watch(
Expand Down

0 comments on commit 616591b

Please sign in to comment.