//class Exchange_Info { // constructor() { // this.height = height; // } //} // //class Header { // constructor() { // this.height = height; // } //} class User_Interface{ /* This contains all the code for our User interface. The code is separated into classes that maintain and provide the data and functionality of each panel of the UI. */ constructor() { /* Data object is responsible for fetching and maintaining up-to-date configurable and variable data for the UI */ this.data = new Data(); /* The object that handles the interface controls.*/ this.controls = new Controls(); /* The object that handles the signals interface.*/ this.signals = new Signals(this.data.indicators); /* The object that handles alerts. Pass in the html element that will hold the list of alerts*/ this.alerts = new Alerts("alert_list"); /* The object that handles alerts. Pass in the html element that will hold the strategies interface.*/ this.strats = new Strategies("strats_display"); /* The object that handles trades. Pass in the html element that will hold the trade interface.*/ this.trade = new Trade(); /* This javascript class is loaded at the top of the main html document. These classes interact with HTML elements that get parsed later in the main html document. They are wrapped inside a function that executes after the entire document is loaded. TODO: Decouple these object from these elements. Initialize after first call?.*/ window.addEventListener('load', function () { /* Charts object is responsible for maintaining the data visualisation area in the UI. */ let chart_init_data = { chart1_id : window.UI.data.chart1_id, chart2_id : window.UI.data.chart2_id, chart3_id : window.UI.data.chart3_id, trading_pair : window.UI.data.trading_pair, price_history : window.UI.data.price_history } window.UI.charts = new Charts(chart_init_data); /* The Indicators object is responsible for interactions with the edit indicator menu and updating the display on the charts.*/ let ind_init_data = { indicators: window.UI.data.indicators, indicator_data: window.UI.data.indicator_data } /* Pass the initialization for the indicators and a reference to the charts object so the indicators can update it directly.*/ window.UI.indicators = new Indicators(window.UI.charts, ind_init_data); /* Point the callback fired when indicator updates are received to the indicator class object.*/ window.UI.data.set_i_updates(window.UI.indicators.update); // Request data from the server. Receives it in a callback function then injects the html. window.UI.signals.request_signals(); // initialize the alerts instance. window.UI.alerts.set_target(); // initialize the strategies instance. window.UI.strats.initialize(); // initialize the controls instance. window.UI.controls.init_TP_selector(); window.UI.trade.initialize(); }); } } UI = new User_Interface();