Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
912abfac
Commit
912abfac
authored
Nov 14, 2017
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_officejs] Bootloader, wait for serviceworker active before finish install
parent
4c5b6ec3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.js
...lateItem/web_page_module/gadget_officejs_bootloader_js.js
+26
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.xml
...ateItem/web_page_module/gadget_officejs_bootloader_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.js
View file @
912abfac
...
...
@@ -48,6 +48,29 @@ var repair = false;
});
}
function
waitForServiceWorkerActive
(
registration
)
{
var
serviceWorker
;
if
(
registration
.
installing
)
{
serviceWorker
=
registration
.
installing
;
}
else
if
(
registration
.
waiting
)
{
serviceWorker
=
registration
.
waiting
;
}
else
if
(
registration
.
active
)
{
serviceWorker
=
registration
.
active
;
}
if
(
serviceWorker
.
state
!==
"
activated
"
)
{
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
serviceWorker
.
addEventListener
(
'
statechange
'
,
function
(
e
)
{
if
(
e
.
target
.
state
===
"
activated
"
)
{
resolve
();
}
});
RSVP
.
delay
(
500
).
then
(
function
()
{
reject
(
new
Error
(
"
Timeout service worker install
"
));
});
});
}
}
rJS
(
window
)
.
setState
({
error_amount
:
0
})
.
ready
(
function
(
gadget
)
{
...
...
@@ -175,6 +198,9 @@ var repair = false;
"
gadget_officejs_bootloader_serviceworker.js
"
);
})
.
push
(
function
(
registration
)
{
return
waitForServiceWorkerActive
(
registration
);
})
.
push
(
undefined
,
function
(
error
)
{
return
gadget
.
changeState
({
error_amount
:
gadget
.
state
.
error_amount
+
1
,
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_bootloader_js.xml
View file @
912abfac
...
...
@@ -236,7 +236,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
963.2
3305.42668.58504
</string>
</value>
<value>
<string>
963.2
9130.48991.23978
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>
1510
305608.12
</float>
<float>
1510
654966.6
</float>
<string>
UTC
</string>
</tuple>
</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