@millistream/millistream-widgets 1.0.28 → 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.
@@ -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',
@@ -3815,7 +3815,7 @@ function Milli_OptionsList(settings) {
3815
3815
  if (m_strikedates.length == 0) return;
3816
3816
  for (let s = 0; s < m_strikedates.length; s++) {
3817
3817
  let display = '';
3818
- let tr;
3818
+ let tr, th;
3819
3819
  if (_this.settings.strikedateHeader) {
3820
3820
  tr = MillistreamWidgetApi_addElement(_this, 'tr', null, tbody);
3821
3821
  tr.setAttribute('data-strikedate', m_strikedates[s].strikedate);
@@ -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
- millistream_data_api.fetch(url, function(data) {
4082
- buildlist(data);
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@millistream/millistream-widgets",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Millistream widgets node package",
5
5
  "main": "millistream-widgets.js",
6
6
  "scripts": {