unregister
133 })
134}
135
136export function unregister(): void {137 if ('serviceWorker' in navigator) {
138 navigator.serviceWorker.ready
139 .then((registration) => {
registerValidSW
59 }
60}
61
62function registerValidSW(swUrl: string, config?: Config) { 63 navigator.serviceWorker
64 .register(swUrl)
65 .then((registration) => {
register
25 onUpdate?: (registration: ServiceWorkerRegistration) => void
26}
27
28export function register(config?: Config): void { 29 if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
30 // The URL constructor is available in all browsers that support SW.
31 const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href)
isUpdateNeeded
9 // Do nothing
10 }
11
12 isUpdateNeeded(): boolean {13 return false
14 }
15}
NullPersistenceService
1import PersistenceService from './persistenceService'
2
3class NullPersistenceService implements PersistenceService { 4 setUpdateIsNeeded(): void {
5 // Do nothing
6 }
It is recommended to have documentation comments above, or right inside a function/class declaration. This helps developers, users and even the author understand the purpose of a code snippet or API function in the future.
NOTE: If you want to stop this issue from getting raised on certain constructs (arrow functions, class expressions, methods etc.), consider using the skipdoccoverage option under the analyzers.meta
property in your .deepsource.toml
file.
For example, the following configuration will silence this issue for class expressions and method definitions:
[analyzers.meta]
skip_doc_coverage = ["class-expression", "method-definition"]
function sum(a, b) {
return a + b;
}
/**
* Function to add two numbers
* @param a The first number to add
* @param b The second number to add
* @returns The sum of two numbers
*/
function sum(a, b) {
return a + b;
}