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

feat: add separate type definitions for `updateServiceWorker() and updateServiceWorker(true) #802

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions preact.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ declare module 'virtual:pwa-register/preact' {
export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: [boolean, StateUpdater<boolean>]
offlineReady: [boolean, StateUpdater<boolean>]
/**
* Reloads the current window to allow the service worker take the control.
*
* @param reloadPage From version 0.13.2+ this param is not used anymore.
*/
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
updateServiceWorker: {
/**
* Reloads the current window to allow the service worker take the control.
*/
(): Promise<void>
/**
* @deprecated The `reloadPage` param is not used anymore sice 0.14.0
*/
(reloadPage: boolean): Promise<void>
}
}
}
16 changes: 10 additions & 6 deletions react.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ declare module 'virtual:pwa-register/react' {
export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: [boolean, Dispatch<SetStateAction<boolean>>]
offlineReady: [boolean, Dispatch<SetStateAction<boolean>>]
/**
* Reloads the current window to allow the service worker take the control.
*
* @param reloadPage From version 0.13.2+ this param is not used anymore.
*/
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
updateServiceWorker: {
/**
* Reloads the current window to allow the service worker take the control.
*/
(): Promise<void>
/**
* @deprecated The `reloadPage` param is not used anymore sice 0.14.0
*/
(reloadPage: boolean): Promise<void>
}
}
}
16 changes: 10 additions & 6 deletions solid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ declare module 'virtual:pwa-register/solid' {
export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: [Accessor<boolean>, Setter<boolean>]
offlineReady: [Accessor<boolean>, Setter<boolean>]
/**
* Reloads the current window to allow the service worker take the control.
*
* @param reloadPage From version 0.13.2+ this param is not used anymore.
*/
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
updateServiceWorker: {
/**
* Reloads the current window to allow the service worker take the control.
*/
(): Promise<void>
/**
* @deprecated The `reloadPage` param is not used anymore sice 0.14.0
*/
(reloadPage: boolean): Promise<void>
}
}
}
16 changes: 10 additions & 6 deletions svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ declare module 'virtual:pwa-register/svelte' {
export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: Writable<boolean>
offlineReady: Writable<boolean>
/**
* Reloads the current window to allow the service worker take the control.
*
* @param reloadPage From version 0.13.2+ this param is not used anymore.
*/
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
updateServiceWorker: {
/**
* Reloads the current window to allow the service worker take the control.
*/
(): Promise<void>
/**
* @deprecated The `reloadPage` param is not used anymore sice 0.14.0
*/
(reloadPage: boolean): Promise<void>
}
}
}
10 changes: 8 additions & 2 deletions vanillajs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ declare module 'virtual:pwa-register' {
* Registers the service worker returning a callback to reload the current page when an update is found.
*
* @param options the options to register the service worker.
* @return (reloadPage?: boolean) => Promise<void> From version 0.13.2+ `reloadPage` param is not used anymore.
* @return (reloadPage?: boolean) => Promise<void> From version 0.14.0+ `reloadPage` param is not used anymore.
*/
export function registerSW(options?: RegisterSWOptions): (reloadPage?: boolean) => Promise<void>
export function registerSW(options?: RegisterSWOptions): {
(): Promise<void>
/**
* @deprecated The `reloadPage` param is not used anymore sice 0.14.0
*/
(reloadPage: boolean): Promise<void>
}
}
16 changes: 10 additions & 6 deletions vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ declare module 'virtual:pwa-register/vue' {
export function useRegisterSW(options?: RegisterSWOptions): {
needRefresh: Ref<boolean>
offlineReady: Ref<boolean>
/**
* Reloads the current window to allow the service worker take the control.
*
* @param reloadPage From version 0.13.2+ this param is not used anymore.
*/
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
updateServiceWorker: {
/**
* Reloads the current window to allow the service worker take the control.
*/
(): Promise<void>
/**
* @deprecated The `reloadPage` param is not used anymore sice 0.14.0
*/
(reloadPage: boolean): Promise<void>
}
}
}