@bbn/bbn 1.0.69 → 1.0.70

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/dist/bundle.js CHANGED
@@ -942,6 +942,7 @@
942
942
  * @returns {Number} The timestamp (in ms)
943
943
  */
944
944
  const _addLoader = function (requestId, prom, source) {
945
+ console.log('_addLoader', requestId);
945
946
  /** @var {Number} tst Current timestamp */
946
947
  let tst = new Date().getTime();
947
948
  /** @var {String} url The original URL (part of requestId before : and md5) */
@@ -3138,7 +3139,7 @@
3138
3139
  * @returns {Promise} The Promise created by the generated XHR.
3139
3140
  */
3140
3141
  const ajax = function (url, datatype, data, success, failure, abort) {
3141
- if (arguments.length === 1 && url && typeof url === 'object' && url.url) {
3142
+ if (arguments.length === 1 && url && typeof url === "object" && url.url) {
3142
3143
  if (url.abort) {
3143
3144
  abort = url.abort;
3144
3145
  }
@@ -3159,13 +3160,13 @@
3159
3160
  if (!url) {
3160
3161
  return;
3161
3162
  }
3162
- if (url && typeof url === 'string') {
3163
- if (url.indexOf('://') === -1) {
3163
+ if (url && typeof url === "string") {
3164
+ if (url.indexOf("://") === -1) {
3164
3165
  // Prevent protocol mismatch by Axios
3165
- url = (0, replaceAll_1.replaceAll)('//', '/', url);
3166
+ url = (0, replaceAll_1.replaceAll)("//", "/", url);
3166
3167
  }
3167
3168
  if (!datatype) {
3168
- datatype = 'json';
3169
+ datatype = "json";
3169
3170
  }
3170
3171
  let requestId = (0, getRequestId_1.getRequestId)(url, data, datatype);
3171
3172
  let loaderObj = (0, getLoader_2.getLoader)(requestId);
@@ -3182,10 +3183,10 @@
3182
3183
  responseType: datatype,
3183
3184
  cancelToken: source.token,
3184
3185
  };
3185
- if (datatype === 'text') {
3186
+ if (datatype === "text") {
3186
3187
  options.headers = {
3187
- accept: 'text/javascript',
3188
- 'Content-Type': 'text/javascript',
3188
+ accept: "text/javascript",
3189
+ "Content-Type": "text/javascript",
3189
3190
  };
3190
3191
  }
3191
3192
  let args = [url];
@@ -3193,9 +3194,10 @@
3193
3194
  args.push(data);
3194
3195
  }
3195
3196
  args.push(options);
3196
- const axiosMethod = args.length === 2 ? 'get' : 'post';
3197
- let loader = axios[axiosMethod].apply(null, args)
3198
- .then(res => {
3197
+ const axiosMethod = args.length === 2 ? "get" : "post";
3198
+ let loader = axios[axiosMethod]
3199
+ .apply(null, args)
3200
+ .then((res) => {
3199
3201
  (0, _deleteLoader_1._deleteLoader)(requestId, res);
3200
3202
  (0, defaultEndLoadingFunction_1.defaultEndLoadingFunction)(url, tst, data, res);
3201
3203
  switch (res.status) {
@@ -3228,7 +3230,7 @@
3228
3230
  ok = failure(err.request, err);
3229
3231
  }
3230
3232
  if (ok) {
3231
- (0, defaultAjaxErrorFunction_1.defaultAjaxErrorFunction)(err.request, err.response ? err.response.data : '', err.response ? err.response.status : err);
3233
+ (0, defaultAjaxErrorFunction_1.defaultAjaxErrorFunction)(err.request, err.response ? err.response.data : "", err.response ? err.response.status : err);
3232
3234
  }
3233
3235
  }
3234
3236
  });
@@ -14,6 +14,7 @@ import { substr } from "../string/substr";
14
14
  * @returns {Number} The timestamp (in ms)
15
15
  */
16
16
  const _addLoader = function (requestId, prom, source) {
17
+ console.log('_addLoader', requestId);
17
18
  /** @var {Number} tst Current timestamp */
18
19
  let tst = new Date().getTime();
19
20
  /** @var {String} url The original URL (part of requestId before : and md5) */
@@ -1,16 +1,16 @@
1
- import { isObject } from '../type/isObject';
2
- import { replaceAll } from '../string/replaceAll';
3
- import { getRequestId } from './getRequestId';
4
- import { getLoader } from './getLoader';
5
- import { extend } from '../object/extend';
6
- import { numProperties } from '../object/numProperties';
7
- import { _deleteLoader } from './_deleteLoader';
8
- import { defaultEndLoadingFunction } from '../default/defaultEndLoadingFunction';
9
- import { isFunction } from '../type/isFunction';
10
- import { defaultAjaxErrorFunction } from '../default/defaultAjaxErrorFunction';
11
- import { defaultAjaxAbortFunction } from '../default/defaultAjaxAbortFunction';
12
- import { _addLoader } from './_addLoader';
13
- import { defaultStartLoadingFunction } from '../default/defaultStartLoadingFunction';
1
+ import { isObject } from "../type/isObject";
2
+ import { replaceAll } from "../string/replaceAll";
3
+ import { getRequestId } from "./getRequestId";
4
+ import { getLoader } from "./getLoader";
5
+ import { extend } from "../object/extend";
6
+ import { numProperties } from "../object/numProperties";
7
+ import { _deleteLoader } from "./_deleteLoader";
8
+ import { defaultEndLoadingFunction } from "../default/defaultEndLoadingFunction";
9
+ import { isFunction } from "../type/isFunction";
10
+ import { defaultAjaxErrorFunction } from "../default/defaultAjaxErrorFunction";
11
+ import { defaultAjaxAbortFunction } from "../default/defaultAjaxAbortFunction";
12
+ import { _addLoader } from "./_addLoader";
13
+ import { defaultStartLoadingFunction } from "../default/defaultStartLoadingFunction";
14
14
  /**
15
15
  * Creates an XHR object and returns the Promise.
16
16
  *
@@ -68,7 +68,7 @@ import { defaultStartLoadingFunction } from '../default/defaultStartLoadingFunct
68
68
  * @returns {Promise} The Promise created by the generated XHR.
69
69
  */
70
70
  const ajax = function (url, datatype, data, success, failure, abort) {
71
- if (arguments.length === 1 && url && typeof url === 'object' && url.url) {
71
+ if (arguments.length === 1 && url && typeof url === "object" && url.url) {
72
72
  if (url.abort) {
73
73
  abort = url.abort;
74
74
  }
@@ -89,13 +89,13 @@ const ajax = function (url, datatype, data, success, failure, abort) {
89
89
  if (!url) {
90
90
  return;
91
91
  }
92
- if (url && typeof url === 'string') {
93
- if (url.indexOf('://') === -1) {
92
+ if (url && typeof url === "string") {
93
+ if (url.indexOf("://") === -1) {
94
94
  // Prevent protocol mismatch by Axios
95
- url = replaceAll('//', '/', url);
95
+ url = replaceAll("//", "/", url);
96
96
  }
97
97
  if (!datatype) {
98
- datatype = 'json';
98
+ datatype = "json";
99
99
  }
100
100
  let requestId = getRequestId(url, data, datatype);
101
101
  let loaderObj = getLoader(requestId);
@@ -112,10 +112,10 @@ const ajax = function (url, datatype, data, success, failure, abort) {
112
112
  responseType: datatype,
113
113
  cancelToken: source.token,
114
114
  };
115
- if (datatype === 'text') {
115
+ if (datatype === "text") {
116
116
  options.headers = {
117
- accept: 'text/javascript',
118
- 'Content-Type': 'text/javascript',
117
+ accept: "text/javascript",
118
+ "Content-Type": "text/javascript",
119
119
  };
120
120
  }
121
121
  let args = [url];
@@ -123,9 +123,10 @@ const ajax = function (url, datatype, data, success, failure, abort) {
123
123
  args.push(data);
124
124
  }
125
125
  args.push(options);
126
- const axiosMethod = args.length === 2 ? 'get' : 'post';
127
- let loader = axios[axiosMethod].apply(null, args)
128
- .then(res => {
126
+ const axiosMethod = args.length === 2 ? "get" : "post";
127
+ let loader = axios[axiosMethod]
128
+ .apply(null, args)
129
+ .then((res) => {
129
130
  _deleteLoader(requestId, res);
130
131
  defaultEndLoadingFunction(url, tst, data, res);
131
132
  switch (res.status) {
@@ -158,7 +159,7 @@ const ajax = function (url, datatype, data, success, failure, abort) {
158
159
  ok = failure(err.request, err);
159
160
  }
160
161
  if (ok) {
161
- defaultAjaxErrorFunction(err.request, err.response ? err.response.data : '', err.response ? err.response.status : err);
162
+ defaultAjaxErrorFunction(err.request, err.response ? err.response.data : "", err.response ? err.response.status : err);
162
163
  }
163
164
  }
164
165
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",