Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo Le Bouter
erp5
Commits
14420bf2
Commit
14420bf2
authored
Aug 17, 2017
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_officejs] Bootloader Service Worker, fetch from network when referrer is the scope
Allowed change cache to update application.
parent
8ab1add8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
26 deletions
+48
-26
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.js
...age_module/gadget_officejs_bootloader_serviceworker_js.js
+46
-24
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.xml
...ge_module/gadget_officejs_bootloader_serviceworker_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.js
View file @
14420bf2
...
@@ -25,6 +25,20 @@ var global = self, window = self;
...
@@ -25,6 +25,20 @@ var global = self, window = self;
});
});
}
}
function
getFromLocal
(
relative_url
)
{
if
(
self
.
storage
.
get
===
undefined
)
{
self
.
storage
=
createStorage
(
"
ojs_source_code
"
);
}
return
self
.
storage
.
getAttachment
(
self
.
registration
.
scope
,
relative_url
)
.
push
(
function
(
blob
)
{
return
new
Response
(
blob
,
{
'
headers
'
:
{
'
content-type
'
:
blob
.
type
}
});
});
}
self
.
addEventListener
(
'
install
'
,
function
(
event
)
{
self
.
addEventListener
(
'
install
'
,
function
(
event
)
{
event
.
waitUntil
(
self
.
skipWaiting
());
event
.
waitUntil
(
self
.
skipWaiting
());
});
});
...
@@ -43,33 +57,41 @@ var global = self, window = self;
...
@@ -43,33 +57,41 @@ var global = self, window = self;
event
.
respondWith
(
new
Response
(
self
.
cache_list
));
event
.
respondWith
(
new
Response
(
self
.
cache_list
));
return
;
return
;
}
}
event
.
respondWith
(
else
if
(
event
.
request
!==
undefined
&&
event
.
request
.
referrer
===
self
.
registration
.
scope
)
{
new
self
.
RSVP
.
Queue
()
event
.
respondWith
(
.
push
(
function
()
{
new
self
.
RSVP
.
Queue
()
if
(
self
.
storage
.
get
===
undefined
)
{
.
push
(
function
()
{
self
.
storage
=
createStorage
(
"
ojs_source_code
"
);
return
fetch
(
event
.
request
);
}
})
return
self
.
storage
.
getAttachment
(
self
.
registration
.
scope
,
relative_url
)
.
push
(
function
(
response
)
{
.
push
(
function
(
blob
)
{
if
(
response
.
status
===
200
)
{
return
new
Response
(
blob
,
{
return
response
;
'
headers
'
:
{
}
'
content-type
'
:
blob
.
type
return
getFromLocal
(
relative_url
);
})
.
push
(
undefined
,
function
(
error
)
{
return
new
Response
(
error
,
{
"
statusText
"
:
error
.
message
,
"
status
"
:
500
});
})
);
}
else
{
event
.
respondWith
(
new
self
.
RSVP
.
Queue
()
.
push
(
function
()
{
return
getFromLocal
(
relative_url
);
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
instanceof
self
.
jIO
.
util
.
jIOError
)
{
if
(
relative_url
.
indexOf
(
'
http
'
)
===
-
1
)
{
if
(
self
.
cache_list
.
indexOf
(
relative_url
)
===
-
1
)
{
self
.
cache_list
.
push
(
relative_url
);
}
}
});
});
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
instanceof
self
.
jIO
.
util
.
jIOError
)
{
if
(
relative_url
.
indexOf
(
'
http
'
)
===
-
1
)
{
if
(
self
.
cache_list
.
indexOf
(
relative_url
)
===
-
1
)
{
self
.
cache_list
.
push
(
relative_url
);
}
}
return
fetch
(
event
.
request
);
}
}
return
fetch
(
event
.
request
);
return
new
Response
(
error
,
{
"
statusText
"
:
error
.
message
,
"
status
"
:
500
});
}
})
return
new
Response
(
error
,
{
"
statusText
"
:
error
.
message
,
"
status
"
:
500
});
);
})
}
);
});
});
}(
self
,
fetch
,
Request
,
Response
));
}(
self
,
fetch
,
Request
,
Response
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_serviceworker_js.xml
View file @
14420bf2
...
@@ -227,7 +227,7 @@
...
@@ -227,7 +227,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
961.
10686.10882.5973
</string>
</value>
<value>
<string>
961.
30858.43041.57309
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -245,7 +245,7 @@
...
@@ -245,7 +245,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1502
096517.05
</float>
<float>
1502
980874.99
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment