@cocalc/static
Version:
CoCalc's static frontend Webpack-based build system and framework
26 lines • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
// Load the custom manifest for our site, which is necessary so that we can
// install the page as a local webapp. It's part of being a "progressive
// web app", as was started in this PR: https://github.com/sagemathinc/cocalc/pull/5254
const react_helmet_1 = require("react-helmet");
const path_1 = require("path");
const app_base_path_1 = require("@cocalc/frontend/customize/app-base-path");
window.addEventListener("load", async function () {
const path = (0, path_1.join)(app_base_path_1.appBasePath, "webapp/serviceWorker.js");
try {
await navigator.serviceWorker.register(path, {
scope: app_base_path_1.appBasePath,
});
console.log(`${path} registered successful`);
}
catch (err) {
console.log(`${path} registration failed: `, err);
}
});
function Manifest() {
return ((0, jsx_runtime_1.jsx)(react_helmet_1.Helmet, { children: (0, jsx_runtime_1.jsx)("link", { rel: "manifest", href: (0, path_1.join)(app_base_path_1.appBasePath, "customize?type=manifest") }) }));
}
exports.default = Manifest;
//# sourceMappingURL=manifest.js.map