diff --git a/asset-manifest.json b/asset-manifest.json index d72e704..726c8c3 100644 --- a/asset-manifest.json +++ b/asset-manifest.json @@ -1,13 +1,13 @@ { "main.css": "/react-circular-progressbar/static/css/main.c5efd66a.chunk.css", - "main.js": "/react-circular-progressbar/static/js/main.3dc6ef97.chunk.js", - "main.js.map": "/react-circular-progressbar/static/js/main.3dc6ef97.chunk.js.map", + "main.js": "/react-circular-progressbar/static/js/main.9c6e71d5.chunk.js", + "main.js.map": "/react-circular-progressbar/static/js/main.9c6e71d5.chunk.js.map", "runtime~main.js": "/react-circular-progressbar/static/js/runtime~main.3915c496.js", "runtime~main.js.map": "/react-circular-progressbar/static/js/runtime~main.3915c496.js.map", "static/js/2.78985d59.chunk.js": "/react-circular-progressbar/static/js/2.78985d59.chunk.js", "static/js/2.78985d59.chunk.js.map": "/react-circular-progressbar/static/js/2.78985d59.chunk.js.map", "index.html": "/react-circular-progressbar/index.html", - "precache-manifest.73a345687549ea17ebc00036096ed624.js": "/react-circular-progressbar/precache-manifest.73a345687549ea17ebc00036096ed624.js", + "precache-manifest.766ce7305bc0a79042e912818954d250.js": "/react-circular-progressbar/precache-manifest.766ce7305bc0a79042e912818954d250.js", "service-worker.js": "/react-circular-progressbar/service-worker.js", "static/css/main.c5efd66a.chunk.css.map": "/react-circular-progressbar/static/css/main.c5efd66a.chunk.css.map" } \ No newline at end of file diff --git a/index.html b/index.html index 09f873a..758cdcf 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -React App
\ No newline at end of file +react-circular-progressbar: a circular progress indicator component
\ No newline at end of file diff --git a/precache-manifest.73a345687549ea17ebc00036096ed624.js b/precache-manifest.766ce7305bc0a79042e912818954d250.js similarity index 69% rename from precache-manifest.73a345687549ea17ebc00036096ed624.js rename to precache-manifest.766ce7305bc0a79042e912818954d250.js index 60b965e..a5b074c 100644 --- a/precache-manifest.73a345687549ea17ebc00036096ed624.js +++ b/precache-manifest.766ce7305bc0a79042e912818954d250.js @@ -1,11 +1,11 @@ self.__precacheManifest = [ { - "revision": "7cdb4ece0cbb9d293157", + "revision": "a86c43cb0903b46259e1", "url": "/react-circular-progressbar/static/css/main.c5efd66a.chunk.css" }, { - "revision": "7cdb4ece0cbb9d293157", - "url": "/react-circular-progressbar/static/js/main.3dc6ef97.chunk.js" + "revision": "a86c43cb0903b46259e1", + "url": "/react-circular-progressbar/static/js/main.9c6e71d5.chunk.js" }, { "revision": "84b3e6b81f1edb806d20", @@ -16,7 +16,7 @@ self.__precacheManifest = [ "url": "/react-circular-progressbar/static/js/2.78985d59.chunk.js" }, { - "revision": "bc4983a6ee0fdd8f864d696e4fe83501", + "revision": "92bd69adee608b6336d5ae5c0940c4c8", "url": "/react-circular-progressbar/index.html" } ]; \ No newline at end of file diff --git a/service-worker.js b/service-worker.js index 451590f..bccbf01 100644 --- a/service-worker.js +++ b/service-worker.js @@ -14,7 +14,7 @@ importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js"); importScripts( - "/react-circular-progressbar/precache-manifest.73a345687549ea17ebc00036096ed624.js" + "/react-circular-progressbar/precache-manifest.766ce7305bc0a79042e912818954d250.js" ); workbox.clientsClaim(); diff --git a/static/js/main.3dc6ef97.chunk.js b/static/js/main.3dc6ef97.chunk.js deleted file mode 100644 index dd404f9..0000000 --- a/static/js/main.3dc6ef97.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{1:function(e,t,a){"use strict";var n=this&&this.__extends||function(){var e=function(t,a){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a])})(t,a)};return function(t,a){function n(){this.constructor=t}e(t,a),t.prototype=null===a?Object.create(a):(n.prototype=a.prototype,new n)}}(),r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=r(a(16)),o=function(e){function t(t){var a=e.call(this,t)||this;return a.initialTimeout=void 0,a.requestAnimationFrame=void 0,a.state={percentage:t.initialAnimation?0:t.percentage},a}return n(t,e),t.prototype.componentDidMount=function(){var e=this;this.props.initialAnimation&&(this.initialTimeout=window.setTimeout(function(){e.requestAnimationFrame=window.requestAnimationFrame(function(){e.setState({percentage:e.props.percentage})})},0))},t.prototype.componentWillReceiveProps=function(e){this.setState({percentage:e.percentage})},t.prototype.componentWillUnmount=function(){clearTimeout(this.initialTimeout),this.requestAnimationFrame&&window.cancelAnimationFrame(this.requestAnimationFrame)},t.prototype.getBackgroundPadding=function(){return this.props.background?null==this.props.backgroundPadding?this.props.strokeWidth:this.props.backgroundPadding:0},t.prototype.getPathDescription=function(){var e=this.getPathRadius(),t=this.props.counterClockwise?1:0;return"\n M 50,50\n m 0,-"+e+"\n a "+e+","+e+" "+t+" 1 1 0,"+2*e+"\n a "+e+","+e+" "+t+" 1 1 0,-"+2*e+"\n "},t.prototype.getPathStyles=function(){var e=2*Math.PI*this.getPathRadius(),t=(100-Math.min(Math.max(this.state.percentage,0),100))/100*e;return{strokeDasharray:e+"px "+e+"px",strokeDashoffset:(this.props.counterClockwise?-t:t)+"px"}},t.prototype.getPathRadius=function(){return 50-this.props.strokeWidth/2-this.getBackgroundPadding()},t.prototype.render=function(){var e=this.props,t=(e.percentage,e.className),a=e.classes,n=e.styles,r=e.strokeWidth,o=e.text,i=this.getPathDescription();return c.default.createElement("svg",{className:a.root+" "+t,style:n.root,viewBox:"0 0 100 100"},this.props.background?c.default.createElement("circle",{className:a.background,style:n.background,cx:50,cy:50,r:50}):null,c.default.createElement("path",{className:a.trail,style:n.trail,d:i,strokeWidth:r,fillOpacity:0}),c.default.createElement("path",{className:a.path,d:i,strokeWidth:r,fillOpacity:0,style:Object.assign({},n.path,this.getPathStyles())}),o?c.default.createElement("text",{className:a.text,style:n.text,x:50,y:50},o):null)},t.defaultProps={strokeWidth:8,className:"",text:"",classes:{root:"CircularProgressbar",trail:"CircularProgressbar-trail",path:"CircularProgressbar-path",text:"CircularProgressbar-text",background:"CircularProgressbar-background"},styles:{root:{},trail:{},path:{},text:{},background:{}},background:!1,backgroundPadding:0,initialAnimation:!1,counterClockwise:!1},t}(c.default.Component);t.default=o},15:function(e,t,a){},19:function(e,t,a){},20:function(e,t,a){},21:function(e,t,a){"use strict";a.r(t);var n=a(0),r=a.n(n),c=a(8),o=a.n(c),i=(a(15),a(2)),s=a(3),l=a(5),u=a(4),m=a(6),p=a(1),d=a.n(p),h=function(e){function t(){var e,a;Object(i.a)(this,t);for(var n=arguments.length,r=new Array(n),c=0;c string;\n stylesForPercentage?: (percentage: number) => {};\n textForPercentage?: (percentage: number) => string;\n };\n\ntype State = {\n currentPercentageIndex: number;\n};\n\nclass ChangingProgressbar extends React.Component {\n static defaultProps = {\n interval: 1000,\n classForPercentage: (percentage: number) => '',\n stylesForPercentage: (percentage: number) => ({}),\n textForPercentage: (percentage: number) => `${percentage}%`,\n };\n\n state = {\n currentPercentageIndex: 0,\n };\n\n componentDidMount() {\n setInterval(() => {\n this.setState({\n currentPercentageIndex:\n (this.state.currentPercentageIndex + 1) % this.props.percentages.length,\n });\n }, this.props.interval);\n }\n\n getCurrentPercentage() {\n return this.props.percentages[this.state.currentPercentageIndex];\n }\n\n getClassName() {\n return this.props.classForPercentage(this.getCurrentPercentage());\n }\n\n getStyles(): any {\n return this.props.stylesForPercentage(this.getCurrentPercentage());\n }\n\n getText() {\n return this.props.textForPercentage(this.getCurrentPercentage());\n }\n\n render() {\n return (\n \n );\n }\n}\n\nexport default ChangingProgressbar;\n","import React from 'react';\nimport CircularProgressbar from 'react-circular-progressbar';\nimport ChangingProgressbar from './ChangingProgressbar';\n\nconst githubURL = 'https://github.com/kevinsqi/react-circular-progressbar';\n\nconst Example: React.FunctionComponent<{ description: string }> = ({ description, children }) => (\n
\n
\n
{children}
\n
\n

{description}

\n
\n);\n\nfunction Demo() {\n return (\n
\n
\n
\n
\n

react-circular-progressbar

\n

A circular progress indicator component

\n
\n
\n
\n\n
\n
\n {\n const alpha = (100 + percentage) / 200;\n return {\n path: {\n stroke: `rgba(62, 152, 199, ${alpha})`,\n },\n };\n }}\n />\n
\n
\n\n
\n
\n
\n

Built with SVG and styled with plain CSS.

\n
\n\n \n {\n return percentage === 100 ? 'complete' : 'incomplete';\n }}\n textForPercentage={(percentage: number) => {\n return percentage === 100 ? `${percentage}!!` : `${percentage}`;\n }}\n />\n \n\n \n \n \n\n \n \n \n\n \n
\n
\n \n
\n
\n \"doge\"\n
\n
\n
\n
\n\n
\n
\n

Installation

\n
\n

Install with yarn or npm:

\n

\n yarn add react-circular-progressbar\n

\n \n View docs on Github\n \n
\n
\n
\n Built by @kevinsqi\n
\n
\n
\n
\n );\n}\n\nexport default Demo;\n","import React, { Component } from 'react';\nimport CircularProgressbar from 'react-circular-progressbar';\nimport Demo from './Demo';\n\n// Stylesheets\nimport 'react-circular-progressbar/dist/styles.css';\nimport './App.css';\n\nclass App extends Component {\n render() {\n return (\n
\n \n
\n );\n }\n}\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\ntype Config = {\n onSuccess?: (registration: ServiceWorkerRegistration) => void;\n onUpdate?: (registration: ServiceWorkerRegistration) => void;\n};\n\nexport function register(config?: Config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(\n (process as { env: { [key: string]: string } }).env.PUBLIC_URL,\n window.location.href\n );\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl: string, config?: Config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl: string, config?: Config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(, document.getElementById('root'));\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/main.9c6e71d5.chunk.js b/static/js/main.9c6e71d5.chunk.js new file mode 100644 index 0000000..d5beba3 --- /dev/null +++ b/static/js/main.9c6e71d5.chunk.js @@ -0,0 +1,2 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{1:function(e,t,a){"use strict";var r=this&&this.__extends||function(){var e=function(t,a){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a])})(t,a)};return function(t,a){function r(){this.constructor=t}e(t,a),t.prototype=null===a?Object.create(a):(r.prototype=a.prototype,new r)}}(),n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=n(a(16)),s=function(e){function t(t){var a=e.call(this,t)||this;return a.initialTimeout=void 0,a.requestAnimationFrame=void 0,a.state={percentage:t.initialAnimation?0:t.percentage},a}return r(t,e),t.prototype.componentDidMount=function(){var e=this;this.props.initialAnimation&&(this.initialTimeout=window.setTimeout(function(){e.requestAnimationFrame=window.requestAnimationFrame(function(){e.setState({percentage:e.props.percentage})})},0))},t.prototype.componentWillReceiveProps=function(e){this.setState({percentage:e.percentage})},t.prototype.componentWillUnmount=function(){clearTimeout(this.initialTimeout),this.requestAnimationFrame&&window.cancelAnimationFrame(this.requestAnimationFrame)},t.prototype.getBackgroundPadding=function(){return this.props.background?null==this.props.backgroundPadding?this.props.strokeWidth:this.props.backgroundPadding:0},t.prototype.getPathDescription=function(){var e=this.getPathRadius(),t=this.props.counterClockwise?1:0;return"\n M 50,50\n m 0,-"+e+"\n a "+e+","+e+" "+t+" 1 1 0,"+2*e+"\n a "+e+","+e+" "+t+" 1 1 0,-"+2*e+"\n "},t.prototype.getPathStyles=function(){var e=2*Math.PI*this.getPathRadius(),t=(100-Math.min(Math.max(this.state.percentage,0),100))/100*e;return{strokeDasharray:e+"px "+e+"px",strokeDashoffset:(this.props.counterClockwise?-t:t)+"px"}},t.prototype.getPathRadius=function(){return 50-this.props.strokeWidth/2-this.getBackgroundPadding()},t.prototype.render=function(){var e=this.props,t=(e.percentage,e.className),a=e.classes,r=e.styles,n=e.strokeWidth,s=e.text,o=this.getPathDescription();return c.default.createElement("svg",{className:a.root+" "+t,style:r.root,viewBox:"0 0 100 100"},this.props.background?c.default.createElement("circle",{className:a.background,style:r.background,cx:50,cy:50,r:50}):null,c.default.createElement("path",{className:a.trail,style:r.trail,d:o,strokeWidth:n,fillOpacity:0}),c.default.createElement("path",{className:a.path,d:o,strokeWidth:n,fillOpacity:0,style:Object.assign({},r.path,this.getPathStyles())}),s?c.default.createElement("text",{className:a.text,style:r.text,x:50,y:50},s):null)},t.defaultProps={strokeWidth:8,className:"",text:"",background:!1,backgroundPadding:0,initialAnimation:!1,counterClockwise:!1,classes:{root:"CircularProgressbar",trail:"CircularProgressbar-trail",path:"CircularProgressbar-path",text:"CircularProgressbar-text",background:"CircularProgressbar-background"},styles:{root:{},trail:{},path:{},text:{},background:{}}},t}(c.default.Component);t.default=s},15:function(e,t,a){},19:function(e,t,a){},20:function(e,t,a){},21:function(e,t,a){"use strict";a.r(t);var r=a(0),n=a.n(r),c=a(8),s=a.n(c),o=(a(15),a(2)),i=a(3),l=a(5),u=a(4),m=a(6),p=a(1),d=a.n(p),g=function(e){function t(){var e,a;Object(o.a)(this,t);for(var r=arguments.length,n=new Array(r),c=0;c string;\n stylesForPercentage?: (percentage: number) => {};\n textForPercentage?: (percentage: number) => string;\n };\n\ntype State = {\n currentPercentageIndex: number;\n};\n\nclass ChangingProgressbar extends React.Component {\n static defaultProps = {\n interval: 1000,\n classForPercentage: (percentage: number) => '',\n stylesForPercentage: (percentage: number) => ({}),\n textForPercentage: (percentage: number) => `${percentage}%`,\n };\n\n state = {\n currentPercentageIndex: 0,\n };\n\n componentDidMount() {\n setInterval(() => {\n this.setState({\n currentPercentageIndex:\n (this.state.currentPercentageIndex + 1) % this.props.percentages.length,\n });\n }, this.props.interval);\n }\n\n getCurrentPercentage() {\n return this.props.percentages[this.state.currentPercentageIndex];\n }\n\n getClassName() {\n return this.props.classForPercentage(this.getCurrentPercentage());\n }\n\n getStyles() {\n return this.props.stylesForPercentage(this.getCurrentPercentage());\n }\n\n getText() {\n return this.props.textForPercentage(this.getCurrentPercentage());\n }\n\n render() {\n return (\n \n );\n }\n}\n\nexport default ChangingProgressbar;\n","import React from 'react';\nimport CircularProgressbar from 'react-circular-progressbar';\nimport ChangingProgressbar from './ChangingProgressbar';\n\nconst githubURL = 'https://github.com/kevinsqi/react-circular-progressbar';\n\nconst Example: React.FunctionComponent<{ description: string }> = ({ description, children }) => (\n
\n
\n
{children}
\n
\n

{description}

\n
\n);\n\nfunction Demo() {\n return (\n
\n
\n
\n
\n

react-circular-progressbar

\n

A circular progress indicator component

\n
\n
\n
\n\n
\n
\n {\n const alpha = (100 + percentage) / 200;\n return {\n path: {\n stroke: `rgba(62, 152, 199, ${alpha})`,\n },\n };\n }}\n />\n
\n
\n\n
\n
\n
\n

Built with SVG and styled with plain CSS.

\n
\n\n \n {\n return percentage === 100 ? 'complete' : 'incomplete';\n }}\n textForPercentage={(percentage: number) => {\n return percentage === 100 ? `${percentage}!!` : `${percentage}`;\n }}\n />\n \n\n \n \n \n\n \n \n \n\n \n
\n
\n \n
\n
\n \"doge\"\n
\n
\n
\n
\n\n
\n
\n

Installation

\n
\n

Install with yarn or npm:

\n

\n yarn add react-circular-progressbar\n

\n \n View docs on Github\n \n
\n
\n
\n Built by @kevinsqi\n
\n
\n
\n
\n );\n}\n\nexport default Demo;\n","import React, { Component } from 'react';\nimport CircularProgressbar from 'react-circular-progressbar';\nimport Demo from './Demo';\n\n// Stylesheets\nimport 'react-circular-progressbar/dist/styles.css';\nimport './App.css';\n\nclass App extends Component {\n render() {\n return (\n
\n \n
\n );\n }\n}\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\ntype Config = {\n onSuccess?: (registration: ServiceWorkerRegistration) => void;\n onUpdate?: (registration: ServiceWorkerRegistration) => void;\n};\n\nexport function register(config?: Config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(\n (process as { env: { [key: string]: string } }).env.PUBLIC_URL,\n window.location.href\n );\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl: string, config?: Config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl: string, config?: Config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(, document.getElementById('root'));\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""} \ No newline at end of file