This repository was archived by the owner on Dec 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
clear lint #4
Merged
Merged
clear lint #4
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
// Interface style: | ||
export default interface IConstructor<T> extends Function { | ||
new (...args: any[]): T; | ||
} | ||
|
||
// Union Type style: | ||
export type ConstructorUnion<T> = new (...args: any[]) => T; | ||
export type IConstructor<T> = new (...args: any[]) => T; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be called |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,12 @@ const isLocalhost = Boolean( | |
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we delete this files? |
||
); | ||
|
||
type Config = { | ||
interface IConfig { | ||
onSuccess?: (registration: ServiceWorkerRegistration) => void; | ||
onUpdate?: (registration: ServiceWorkerRegistration) => void; | ||
}; | ||
} | ||
|
||
export function register(config?: Config) { | ||
export function register(config?: IConfig) { | ||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { | ||
// The URL constructor is available in all browsers that support SW. | ||
const publicUrl = new URL((process as { env: { [key: string]: string } }).env.PUBLIC_URL, window.location.href); | ||
|
@@ -44,7 +44,8 @@ export function register(config?: Config) { | |
// Add some additional logging to localhost, pointing developers to the | ||
// service worker/PWA documentation. | ||
navigator.serviceWorker.ready.then(() => { | ||
console.log('This web app is being served cache-first by a service ' + 'worker. To learn more, visit https://bit.ly/CRA-PWA'); | ||
/* tslint:disable-next-line no-console */ | ||
console.log('This web app is being served cache-first by a service worker. To learn more, visit https://bit.ly/CRA-PWA'); | ||
}); | ||
} else { | ||
// Is not localhost. Just register service worker | ||
|
@@ -54,7 +55,7 @@ export function register(config?: Config) { | |
} | ||
} | ||
|
||
function registerValidSW(swUrl: string, config?: Config) { | ||
function registerValidSW(swUrl: string, config?: IConfig) { | ||
navigator.serviceWorker | ||
.register(swUrl) | ||
.then((registration) => { | ||
|
@@ -69,6 +70,7 @@ function registerValidSW(swUrl: string, config?: Config) { | |
// At this point, the updated precached content has been fetched, | ||
// but the previous service worker will still serve the older | ||
// content until all client tabs are closed. | ||
/* tslint:disable-next-line no-console */ | ||
console.log('New content is available and will be used when all ' + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'); | ||
|
||
// Execute callback | ||
|
@@ -79,6 +81,7 @@ function registerValidSW(swUrl: string, config?: Config) { | |
// At this point, everything has been precached. | ||
// It's the perfect time to display a | ||
// "Content is cached for offline use." message. | ||
/* tslint:disable-next-line no-console */ | ||
console.log('Content is cached for offline use.'); | ||
|
||
// Execute callback | ||
|
@@ -95,7 +98,7 @@ function registerValidSW(swUrl: string, config?: Config) { | |
}); | ||
} | ||
|
||
function checkValidServiceWorker(swUrl: string, config?: Config) { | ||
function checkValidServiceWorker(swUrl: string, config?: IConfig) { | ||
// Check if the service worker can be found. If it can't reload the page. | ||
fetch(swUrl) | ||
.then((response) => { | ||
|
@@ -114,6 +117,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) { | |
} | ||
}) | ||
.catch(() => { | ||
/* tslint:disable-next-line no-console */ | ||
console.log('No internet connection found. App is running in offline mode.'); | ||
}); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.