diff --git a/js/src/chartviewmodel.js b/js/src/chartviewmodel.js index 289a40b..451e03a 100644 --- a/js/src/chartviewmodel.js +++ b/js/src/chartviewmodel.js @@ -60,10 +60,14 @@ export default class ChartViewModel extends ViewModel { this.buttonElement = document.querySelector('#altitudes'); } + /** + * @return {ChartViewModel} + */ init() { this.chartSetup(); this.setObservers(); this.bindAll(); + return this; } chartSetup() { diff --git a/js/src/configviewmodel.js b/js/src/configviewmodel.js index ee3a3ad..60111cf 100644 --- a/js/src/configviewmodel.js +++ b/js/src/configviewmodel.js @@ -34,9 +34,13 @@ export default class ConfigViewModel extends ViewModel { this.model.onSetInterval = () => this.setAutoReloadInterval(); } + /** + * @return {ConfigViewModel} + */ init() { this.setObservers(); this.bindAll(); + return this; } setObservers() { diff --git a/js/src/mainviewmodel.js b/js/src/mainviewmodel.js index 645fcf5..a75eca9 100644 --- a/js/src/mainviewmodel.js +++ b/js/src/mainviewmodel.js @@ -39,8 +39,12 @@ export default class MainViewModel extends ViewModel { this.userMenuEl = document.querySelector('#user-menu'); } + /** + * @return {MainViewModel} + */ init() { this.bindAll(); + return this; } toggleSideMenu() { diff --git a/js/src/mapviewmodel.js b/js/src/mapviewmodel.js index 6828c84..a8cd613 100644 --- a/js/src/mapviewmodel.js +++ b/js/src/mapviewmodel.js @@ -64,9 +64,13 @@ export default class MapViewModel extends ViewModel { this.api = null; } + /** + * @return {MapViewModel} + */ init() { this.bindAll(); this.setObservers(); + return this; } /** diff --git a/js/src/trackviewmodel.js b/js/src/trackviewmodel.js index 31ba148..b8d15ff 100644 --- a/js/src/trackviewmodel.js +++ b/js/src/trackviewmodel.js @@ -66,9 +66,13 @@ export default class TrackViewModel extends ViewModel { this.timerId = 0; } + /** + * @return {TrackViewModel} + */ init() { this.setObservers(); this.bindAll(); + return this; } setObservers() { diff --git a/js/src/userviewmodel.js b/js/src/userviewmodel.js index e5de8ea..c8b9519 100644 --- a/js/src/userviewmodel.js +++ b/js/src/userviewmodel.js @@ -44,6 +44,9 @@ export default class UserViewModel extends ViewModel { this.state = state; } + /** + * @return {UserViewModel} + */ init() { this.setObservers(this.state); this.bindAll(); @@ -62,6 +65,7 @@ export default class UserViewModel extends ViewModel { } }) .catch((e) => { uUtils.error(e, `${$._('actionfailure')}\n${e.message}`); }); + return this; } /**