[TASK] Wait for loaded language
This commit is contained in:
parent
b89e99b79e
commit
6add4f0916
@ -1,5 +1,6 @@
|
|||||||
define(['sorttable', 'snabbdom', 'helper'], function (SortTable, V, helper) {
|
define(['sorttable', 'snabbdom', 'helper'], function (SortTable, V, helper) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
V = V.default;
|
||||||
|
|
||||||
function linkName(d) {
|
function linkName(d) {
|
||||||
return (d.source ? d.source.hostname : d.source.id) + ' – ' + d.target.hostname;
|
return (d.source ? d.source.hostname : d.source.id) + ' – ' + d.target.hostname;
|
||||||
@ -30,7 +31,6 @@ define(['sorttable', 'snabbdom', 'helper'], function (SortTable, V, helper) {
|
|||||||
|
|
||||||
return function (linkScale) {
|
return function (linkScale) {
|
||||||
var table = new SortTable(headings, 2, renderRow);
|
var table = new SortTable(headings, 2, renderRow);
|
||||||
V = V.default;
|
|
||||||
|
|
||||||
function renderRow(d) {
|
function renderRow(d) {
|
||||||
var td1Content = [V.h('a', {
|
var td1Content = [V.h('a', {
|
||||||
|
15
lib/main.js
15
lib/main.js
@ -87,6 +87,21 @@ define(['moment', 'utils/router', 'leaflet', 'gui', 'helper', 'utils/language'],
|
|||||||
}
|
}
|
||||||
|
|
||||||
update()
|
update()
|
||||||
|
.then(function (d) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
var count = 0;
|
||||||
|
(function waitForLanguage() {
|
||||||
|
if (Object.keys(_.phrases).length > 0) {
|
||||||
|
resolve(d);
|
||||||
|
} else if (count > 500) {
|
||||||
|
reject(new Error('translation not loaded after 10 seconds'));
|
||||||
|
} else {
|
||||||
|
setTimeout(waitForLanguage.bind(this), 20);
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
})();
|
||||||
|
});
|
||||||
|
})
|
||||||
.then(function (d) {
|
.then(function (d) {
|
||||||
var gui = new GUI(language);
|
var gui = new GUI(language);
|
||||||
gui.setData(d);
|
gui.setData(d);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
define(['d3-interpolate', 'snabbdom', 'filters/genericnode', 'helper'],
|
define(['d3-interpolate', 'snabbdom', 'filters/genericnode', 'helper'],
|
||||||
function (d3Interpolate, V, Filter, helper) {
|
function (d3Interpolate, V, Filter, helper) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
V = V.default;
|
||||||
|
|
||||||
return function (filterManager) {
|
return function (filterManager) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var scale = d3Interpolate.interpolate('#770038', '#dc0067');
|
var scale = d3Interpolate.interpolate('#770038', '#dc0067');
|
||||||
V = V.default;
|
|
||||||
|
|
||||||
var statusTable;
|
var statusTable;
|
||||||
var fwTable;
|
var fwTable;
|
||||||
|
Loading…
Reference in New Issue
Block a user