@millistream/millistream-widgets 1.0.29 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/millistream-widgets.js +21 -5
- package/package.json +1 -1
package/millistream-widgets.js
CHANGED
|
@@ -3493,8 +3493,8 @@ function Milli_OptionsList(settings) {
|
|
|
3493
3493
|
let m_strikes = [];
|
|
3494
3494
|
let m_strikedates = [];
|
|
3495
3495
|
let m_strikepricedecimals = 2;
|
|
3496
|
-
let m_strikeprices = [];
|
|
3497
|
-
|
|
3496
|
+
let m_strikeprices = [];
|
|
3497
|
+
|
|
3498
3498
|
let m_lang_en = {
|
|
3499
3499
|
askprice: 'Ask',
|
|
3500
3500
|
bidprice: 'Bid',
|
|
@@ -4062,6 +4062,18 @@ function Milli_OptionsList(settings) {
|
|
|
4062
4062
|
if (_this.settings.onreadyCallback) _this.settings.onreadyCallback();
|
|
4063
4063
|
}
|
|
4064
4064
|
|
|
4065
|
+
function getXhrJson(url) {
|
|
4066
|
+
var req = new XMLHttpRequest();
|
|
4067
|
+
req.onload = function() {
|
|
4068
|
+
buildlist(JSON.parse(this.responseText));
|
|
4069
|
+
};
|
|
4070
|
+
req.open("GET", url, true);
|
|
4071
|
+
req.onerror = function(error) {
|
|
4072
|
+
console.log('Fetch data error', error);
|
|
4073
|
+
};
|
|
4074
|
+
req.send();
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4065
4077
|
|
|
4066
4078
|
_this.drawWidget = function() {
|
|
4067
4079
|
|
|
@@ -4078,9 +4090,13 @@ function Milli_OptionsList(settings) {
|
|
|
4078
4090
|
m_cellMap = new Map();
|
|
4079
4091
|
|
|
4080
4092
|
let url = MillistreamWidgetApi_buildQuery(_this, 'optionslist');
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
}
|
|
4093
|
+
if (_this.settings.xhr) {
|
|
4094
|
+
getXhrJson(url);
|
|
4095
|
+
} else {
|
|
4096
|
+
millistream_data_api.fetch(url, function(data) {
|
|
4097
|
+
buildlist(data);
|
|
4098
|
+
});
|
|
4099
|
+
}
|
|
4084
4100
|
};
|
|
4085
4101
|
if (this.settings.autodraw == true) this.drawWidget();
|
|
4086
4102
|
|