Skip to content

Commit e42ca0c

Browse files
authored
Merge pull request #11 from anup2702/feature/room-management
feat: Add room management and enhanced presence system
2 parents 654df13 + 607e81b commit e42ca0c

File tree

5 files changed

+10127
-1036
lines changed

5 files changed

+10127
-1036
lines changed

dev-dist/registerSW.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev-dist/sw.js

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
* Copyright 2018 Google Inc. All Rights Reserved.
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
* Unless required by applicable law or agreed to in writing, software
8+
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
* See the License for the specific language governing permissions and
11+
* limitations under the License.
12+
*/
13+
14+
// If the loader is already loaded, just stop.
15+
if (!self.define) {
16+
let registry = {};
17+
18+
// Used for `eval` and `importScripts` where we can't get script URL by other means.
19+
// In both cases, it's safe to use a global var because those functions are synchronous.
20+
let nextDefineUri;
21+
22+
const singleRequire = (uri, parentUri) => {
23+
uri = new URL(uri + ".js", parentUri).href;
24+
return registry[uri] || (
25+
26+
new Promise(resolve => {
27+
if ("document" in self) {
28+
const script = document.createElement("script");
29+
script.src = uri;
30+
script.onload = resolve;
31+
document.head.appendChild(script);
32+
} else {
33+
nextDefineUri = uri;
34+
importScripts(uri);
35+
resolve();
36+
}
37+
})
38+
39+
.then(() => {
40+
let promise = registry[uri];
41+
if (!promise) {
42+
throw new Error(`Module ${uri} didn’t register its module`);
43+
}
44+
return promise;
45+
})
46+
);
47+
};
48+
49+
self.define = (depsNames, factory) => {
50+
const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
51+
if (registry[uri]) {
52+
// Module is already loading or loaded.
53+
return;
54+
}
55+
let exports = {};
56+
const require = depUri => singleRequire(depUri, uri);
57+
const specialDeps = {
58+
module: { uri },
59+
exports,
60+
require
61+
};
62+
registry[uri] = Promise.all(depsNames.map(
63+
depName => specialDeps[depName] || require(depName)
64+
)).then(deps => {
65+
factory(...deps);
66+
return exports;
67+
});
68+
};
69+
}
70+
define(['./workbox-9dc17825'], (function (workbox) { 'use strict';
71+
72+
self.skipWaiting();
73+
workbox.clientsClaim();
74+
75+
/**
76+
* The precacheAndRoute() method efficiently caches and responds to
77+
* requests for URLs in the manifest.
78+
* See https://goo.gl/S9QRab
79+
*/
80+
workbox.precacheAndRoute([{
81+
"url": "registerSW.js",
82+
"revision": "3ca0b8505b4bec776b69afdba2768812"
83+
}, {
84+
"url": "/offline.html",
85+
"revision": "0.kvp38gtfuk"
86+
}], {});
87+
workbox.cleanupOutdatedCaches();
88+
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("/offline.html"), {
89+
allowlist: [/^\/$/],
90+
denylist: [/^\/api\//]
91+
}));
92+
workbox.registerRoute(/^https:\/\/0\.peerjs\.com\//, new workbox.NetworkFirst({
93+
"cacheName": "peerjs-cache",
94+
plugins: [new workbox.ExpirationPlugin({
95+
maxEntries: 10,
96+
maxAgeSeconds: 86400
97+
})]
98+
}), 'GET');
99+
workbox.registerRoute(/^https:\/\/api\.qrserver\.com\//, new workbox.CacheFirst({
100+
"cacheName": "qr-cache",
101+
plugins: [new workbox.ExpirationPlugin({
102+
maxEntries: 50,
103+
maxAgeSeconds: 604800
104+
})]
105+
}), 'GET');
106+
107+
}));

0 commit comments

Comments
 (0)