Commit 5c843963 authored by Vincent Bechu's avatar Vincent Bechu

erp5_officejs: register service worker before synchronisation in bootloader

parent ddc3267a
...@@ -169,28 +169,31 @@ var repair = false; ...@@ -169,28 +169,31 @@ var repair = false;
gadget.props.version_url, gadget.props.version_url,
gadget.props.cache_file gadget.props.cache_file
); );
return gadget.props.storage.repair() return new RSVP.Queue()
.push(function () { .push(function () {
// remove base if present
if (document.querySelector("base")) {
document.querySelector("head").removeChild(
document.querySelector("base")
);
}
return navigator.serviceWorker.register( return navigator.serviceWorker.register(
"gadget_officejs_bootloader_serviceworker.js", "gadget_officejs_bootloader_serviceworker.js",
{"scope": gadget.props.version_url} {"scope": gadget.props.version_url}
); );
}) })
.push(function (registration) { .push(function (registration) {
if (registration.installing) { if (registration.installing) {
gadget.props.serviceWorker = registration.installing; gadget.props.serviceWorker = registration.installing;
} else if (registration.waiting) { } else if (registration.waiting) {
gadget.props.serviceWorker = registration.waiting; gadget.props.serviceWorker = registration.waiting;
} else if (registration.active) { } else if (registration.active) {
gadget.props.serviceWorker = registration.active; gadget.props.serviceWorker = registration.active;
} }
}); return gadget.props.storage.repair();
})
.push(function () {
// remove base if present
if (document.querySelector("base")) {
document.querySelector("head").removeChild(
document.querySelector("base")
);
}
});
}) })
.declareService(function () { .declareService(function () {
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>958.61634.43604.13073</string> </value> <value> <string>958.64411.34322.58368</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1493203361.07</float> <float>1493803864.07</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment