Skip to content

Commit

Permalink
updated manifest.json file and used register by register-pwa.js inste…
Browse files Browse the repository at this point in the history
…ad of directly register from index.html
  • Loading branch information
Moamal-2000 committed Mar 28, 2024
1 parent 33653ec commit adde1f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
17 changes: 0 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,6 @@
<body>
<div id="root"></div>
<script type="module" src="src/main.jsx"></script>

<script>
async function register() {
if ("serviceWorker" in navigator) {
try {
const registration = await navigator.serviceWorker.register(
"./sw.js"
);

console.log("registered", registration);
} catch (e) {
console.log("failed to register", e);
}
}
}
register()
</script>
</body>

</html>
9 changes: 6 additions & 3 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"registerType": "prompt",
"name": "E-Commerce",
"short_name": "E-Commerce",
"description": "Your ultimate destination for effortless online shopping. Discover curated collections, easily add items to your cart and wishlist, and enjoy detailed product descriptions with captivating previews. Experience convenience like never before with our intuitive interface. Shop smarter with us today.",
Expand Down Expand Up @@ -30,8 +31,10 @@
"type": "image/png"
}
],
"theme_color": "#181818",
"background_color": "#181818",
"start_url": ".",
"scope": "/",
"display": "standalone",
"start_url": "."
"orientation": "portrait",
"theme_color": "#181818",
"background_color": "#181818"
}
4 changes: 2 additions & 2 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React, { StrictMode } from "react";
import ReactDOM from "react-dom/client";
import { HelmetProvider } from "react-helmet-async";
import { Provider } from "react-redux";
import * as servicerWorker from "../public/register-pwa.js";
import App from "./App.jsx";
import { store } from "./App/store.jsx";
import "./Styles/main.scss";
// import * as servicerWorker from "../public/register-pwa.js";

ReactDOM.createRoot(document.getElementById("root")).render(
<StrictMode>
Expand All @@ -17,4 +17,4 @@ ReactDOM.createRoot(document.getElementById("root")).render(
</StrictMode>
);

// servicerWorker.register();
servicerWorker.register();

0 comments on commit adde1f7

Please sign in to comment.