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;
gadget.props.version_url,
gadget.props.cache_file
);
return gadget.props.storage.repair()
return new RSVP.Queue()
.push(function () {
// remove base if present
if (document.querySelector("base")) {
document.querySelector("head").removeChild(
document.querySelector("base")
);
}
return navigator.serviceWorker.register(
"gadget_officejs_bootloader_serviceworker.js",
{"scope": gadget.props.version_url}
);
})
.push(function (registration) {
if (registration.installing) {
gadget.props.serviceWorker = registration.installing;
} else if (registration.waiting) {
gadget.props.serviceWorker = registration.waiting;
} else if (registration.active) {
gadget.props.serviceWorker = registration.active;
}
});
if (registration.installing) {
gadget.props.serviceWorker = registration.installing;
} else if (registration.waiting) {
gadget.props.serviceWorker = registration.waiting;
} else if (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 () {
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>958.61634.43604.13073</string> </value>
<value> <string>958.64411.34322.58368</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1493203361.07</float>
<float>1493803864.07</float>
<string>UTC</string>
</tuple>
</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