Skip to content
Snippets Groups Projects
Commit 6eccab71 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] API: Add missing lib qrcode, as a workaround of issue #903

parent 80687f82
No related branches found
No related tags found
No related merge requests found
Pipeline #8649 failed
......@@ -39,6 +39,8 @@
<script src="../lib/numeral/languages/es.js"></script>
<script src="../lib/numeral/languages/it.js"></script>
<script src="../js/vendor/numeral.eo.js"></script>
<script src="../lib/qrcode-generator/js/qrcode.js"></script> <!-- FIXME remove this lib (see #903) -->
<script src="../lib/socket.io-client/dist/socket.io.min.js"></script>
<script src="../lib/underscore/underscore-min.js"></script>
......
......@@ -300,8 +300,8 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium.
};
that.ready = function() {
if (that.started) return $q.when(true);
return that._startPromise || that.start();
if (that.started) return $q.when(that.alive);
return (that._startPromise || that.start());
};
that.start = function() {
......@@ -321,11 +321,10 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium.
}
console.debug("[BMA] Starting {0} {ssl: {1})...".format(that.server, that.useSsl));
var now = Date.now();
that._startPromise = $q.all([
csSettings.ready,
csSettings.ready(),
that.isAlive()
])
.then(function(res) {
......
......@@ -209,7 +209,7 @@ angular.module('cesium.currency.services', ['ngApi', 'cesium.bma.services'])
function ready() {
if (started) return $q.when(data);
return startPromise || start();
return (startPromise || start());
}
function stop() {
......@@ -224,13 +224,30 @@ angular.module('cesium.currency.services', ['ngApi', 'cesium.bma.services'])
}
function start() {
if (startPromise) return startPromise;
if (started) return $q.when(data);
if (!BMA.started) {
return BMA.ready()
.then(function(alive) {
if (alive) return start(); // Loop
return $timeout(start, 500); // Loop, after a delay, because BMA node seems to be not alive...
});
}
console.debug('[currency] Starting...');
var now = Date.now();
startPromise = BMA.ready()
.then(function(started) {
if (started) return true;
return $timeout(function() {return start(true);}, 500);
})
// Load data
.then(loadData)
.then(function(started) {
return loadData();
})
// Emit ready event
.then(function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment