-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsw.js
117 lines (114 loc) · 4.38 KB
/
sw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
* QCObjects SDK 1.0
* ________________
*
* Author: Jean Machuca <correojean@gmail.com>
*
* Cross Browser Javascript Framework for MVC Patterns
* QuickCorp/QCObjects is licensed under the
* GNU Lesser General Public License v3.0
* [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
*
* Permissions of this copyleft license are conditioned on making available
* complete source code of licensed works and modifications under the same
* license or the GNU GPLv3. Copyright and license notices must be preserved.
* Contributors provide an express grant of patent rights. However, a larger
* work using the licensed work through interfaces provided by the licensed
* work may be distributed under different terms and without source code for
* the larger work.
*
* Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
*
* Everyone is permitted to copy and distribute verbatim copies of this
* license document, but changing it is not allowed.
*/
"use strict";
const version = "0.0.1";
const appName = "config.qcobjects";
const cacheName = `qcobjects-qpp-${appName}-${version}`;
self.addEventListener('install', e => {
e.waitUntil(
caches.open(cacheName).then(cache => {
return cache.addAll([
'/',
'/manifest.json',
'/favicon.ico',
'/css/desktop/content.css',
'/css/desktop/container.css',
'/css/desktop/navbar.css',
'/css/desktop/index.css',
'/css/desktop/sidebar.css',
'/css/desktop/footer.css',
'/css/index.css',
'/css/components/card.css',
'/css/theme/redlight/style.css',
'/css/theme/xtra/style.css',
'/css/theme/cyan/style.css',
'/css/theme/basic/style.css',
'/css/mobile/content.css',
'/css/mobile/navbar.css',
'/css/mobile/index.css',
'/css/mobile/sidebar.css',
'/css/mobile/footer.css',
'/js/init.js',
'/js/packages/org.quickcorp.custom.controllers.js',
'/js/packages/org.quickcorp.custom.models.js',
'/js/packages/org.quickcorp.custom.js',
'/js/packages/org.quickcorp.custom.components.js',
'/js/packages/org.quickcorp.custom.views.js',
'/img/Q_web.svg',
'/img/Q_web.png',
'/img/logo.png',
'/js/packages/installer.js',
'/img/icons/icon-192x192.png',
'/js/packages/codemirror/javascript.js',
'/js/packages/codemirror/active-line.js',
'/js/packages/codemirror/codemirror.js',
'/css/form.css',
'/css/codemirror/blackboard.css',
'/css/codemirror/codemirror.css',
'/js/packages/codemirror/matchbrackets.js',
'/templates/components/main.tpl.html',
'/templates/components/card.tpl.html',
'/templates/components/section1.tpl.html',
'/templates/components/article1.tpl.html',
'/templates/components/blank.tpl.html',
'/templates/components/contentblock.tpl.html',
'/templates/components/nav.tpl.html',
'/templates/components/footer.tpl.html',
'/templates/components/header.tpl.html',
'/templates/components/pages/page1.tpl.html',
'https://sdk.qcobjects.dev/css/basic-layout.css',
'https://qcobjects.dev/QCObjects.js',
'https://sdk.qcobjects.dev/QCObjects-SDK.js',
'https://sdk.qcobjects.dev/js/org.quickcorp.models.js',
'https://sdk.qcobjects.dev/js/org.quickcorp.models.js',
'https://sdk.qcobjects.dev/js/org.quickcorp.components.js',
'https://sdk.qcobjects.dev/js/org.quickcorp.controllers.js',
'https://sdk.qcobjects.dev/js/org.quickcorp.views.js',
'https://sdk.qcobjects.dev/js/org.quickcorp.effects.js',
'https://sdk.qcobjects.dev/js/org.quickcorp.tools.canvas.js',
'https://sdk.qcobjects.dev/js/org.quickcorp.tools.layouts.js'
])
.then(() => self.skipWaiting()).catch(function (e){
console.log('error loading sw');
console.log(e);
});
})
);
});
self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim());
});
self.addEventListener('fetch', event => {
event.respondWith(
caches.open(cacheName)
.then(cache => cache.match(event.request, {ignoreSearch: true}))
.then(response => {
return response || fetch(event.request);
}).catch(function (e){
console.log('error in cache of service worker');
console.log(e);
})
);
});