@bbn/bbn 1.0.83 → 1.0.84

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.d.ts CHANGED
@@ -1080,12 +1080,12 @@ declare module "fn/ajax/_deleteLoader" {
1080
1080
  * @memberof bbn.fn
1081
1081
  *
1082
1082
  * @param {String} requestId The unique ID of the request sent
1083
- * @param {*} res The result of the request
1083
+ * @param {String|Object} res The result of the request
1084
1084
  * @param {Boolean} isAbort True if the deletion comes from abortion
1085
1085
  *
1086
1086
  * @returns {Boolean} True if the loader was found
1087
1087
  */
1088
- const _deleteLoader: (requestId: string, res?: any, isAbort?: boolean) => boolean;
1088
+ const _deleteLoader: (requestId: any, res?: any, isAbort?: boolean) => boolean;
1089
1089
  export { _deleteLoader };
1090
1090
  }
1091
1091
  declare module "fn/ajax/getLoader" {
@@ -1122,9 +1122,9 @@ declare module "fn/ajax/getLoader" {
1122
1122
  *
1123
1123
  * @param {String} requestId The unique ID of the request as used in bbn.env.loaders
1124
1124
  *
1125
- * @returns {false|Object} The corresponding loader Object if it exists, false otherwise
1125
+ * @returns {null|Object} The corresponding loader Object if it exists, false otherwise
1126
1126
  */
1127
- const getLoader: (requestId: string) => BbnLoader | null;
1127
+ const getLoader: (requestId: any) => BbnLoader;
1128
1128
  export { getLoader };
1129
1129
  }
1130
1130
  declare module "fn/ajax/abort" {
@@ -1587,7 +1587,7 @@ declare module "fn/ajax/ajax" {
1587
1587
  *
1588
1588
  * @returns {Promise} The Promise created by the generated XHR.
1589
1589
  */
1590
- const ajax: (url: any, datatype: string, data: any, success?: (data: object, headers?: object) => any, failure?: (url: string, o?: object) => any, abort?: (message: string, url: string) => any) => any;
1590
+ const ajax: (url: any, datatype?: any, data?: any, success?: any, failure?: any, abort?: any) => any;
1591
1591
  export { ajax };
1592
1592
  }
1593
1593
  declare module "fn/misc/analyzeFunction" {
@@ -1823,7 +1823,7 @@ declare module "fn/ajax/callback" {
1823
1823
  *
1824
1824
  * @returns {*} The result of the main callback function: res.script, fn, or bbn.fn.defaultLinkFunction
1825
1825
  */
1826
- const callback: (url: any, res: any, fn?: any, fn2?: any, ele?: any) => boolean;
1826
+ const callback: (url: any, res?: any, fn?: any, fn2?: any, ele?: any) => boolean;
1827
1827
  export { callback };
1828
1828
  }
1829
1829
  declare module "fn/string/camelize" {
@@ -2438,7 +2438,7 @@ declare module "fn/ajax/downloadContent" {
2438
2438
  *
2439
2439
  * @returns {undefined}
2440
2440
  */
2441
- const downloadContent: (filename: string, content: any, type?: string) => void;
2441
+ const downloadContent: (filename: any, content: any, type?: any) => void;
2442
2442
  export { downloadContent };
2443
2443
  }
2444
2444
  declare module "fn/ajax/download" {
@@ -4648,7 +4648,7 @@ declare module "fn" {
4648
4648
  const fn: {
4649
4649
  _addLoader: (requestId: any, prom: any, source: any) => number;
4650
4650
  _compareValues: (a: any, b: any, prop: any, dir?: string) => 0 | 1 | -1;
4651
- _deleteLoader: (requestId: string, res?: any, isAbort?: boolean) => boolean;
4651
+ _deleteLoader: (requestId: any, res?: any, isAbort?: boolean) => boolean;
4652
4652
  abort: (requestId: any) => void;
4653
4653
  abortURL: (url: any) => void;
4654
4654
  addColors: (colors: object) => void;
@@ -4657,7 +4657,7 @@ declare module "fn" {
4657
4657
  adjustHeight: () => void;
4658
4658
  adjustSize: (type: any, eles: any) => void;
4659
4659
  adjustWidth: () => void;
4660
- ajax: (url: any, datatype: string, data: any, success?: (data: object, headers?: object) => any, failure?: (url: string, o?: object) => any, abort?: (message: string, url: string) => any) => any;
4660
+ ajax: (url: any, datatype?: any, data?: any, success?: any, failure?: any, abort?: any) => any;
4661
4661
  analyzeFunction: (fn: any) => {
4662
4662
  body: any;
4663
4663
  args: any[];
@@ -4675,7 +4675,7 @@ declare module "fn" {
4675
4675
  baseName: (path: string, suffix?: string) => string;
4676
4676
  br2nl: (st: any) => string;
4677
4677
  calendar: (d?: string | number | Date, wrong_result?: string) => any;
4678
- callback: (url: any, res: any, fn?: any, fn2?: any, ele?: any) => boolean;
4678
+ callback: (url: any, res?: any, fn?: any, fn2?: any, ele?: any) => boolean;
4679
4679
  camelize: (str: any) => any;
4680
4680
  camelToCss: (str: any) => any;
4681
4681
  canvasToImage: (canvas: any) => HTMLImageElement;
@@ -4715,7 +4715,7 @@ declare module "fn" {
4715
4715
  diffObj: (obj1: object, obj2: object, unchanged?: boolean, notRoot?: boolean) => any;
4716
4716
  dirName: (path: any) => string;
4717
4717
  download: (url: any, filename?: string, params?: any) => any;
4718
- downloadContent: (filename: string, content: any, type?: string) => void;
4718
+ downloadContent: (filename: any, content: any, type?: any) => void;
4719
4719
  each: (arr: any, fn: any) => any;
4720
4720
  eraseCookie: (name: any) => void;
4721
4721
  error: (errorMsg: any) => never;
@@ -4756,7 +4756,7 @@ declare module "fn" {
4756
4756
  getFieldValues: (arr: object[], field: string, prop: any, val: any, operator: any) => any[];
4757
4757
  getHtml: (ele: any, stripComments?: boolean) => any;
4758
4758
  getHTMLOfSelection: () => string;
4759
- getLoader: (requestId: string) => BbnLoader;
4759
+ getLoader: (requestId: any) => BbnLoader;
4760
4760
  getPath: (element: any) => string;
4761
4761
  getProp: (obj: any, prop: any) => any;
4762
4762
  getProperty: (obj: any, prop: any) => any;
package/dist/bundle.js CHANGED
@@ -2131,7 +2131,7 @@
2131
2131
  * @memberof bbn.fn
2132
2132
  *
2133
2133
  * @param {String} requestId The unique ID of the request sent
2134
- * @param {*} res The result of the request
2134
+ * @param {String|Object} res The result of the request
2135
2135
  * @param {Boolean} isAbort True if the deletion comes from abortion
2136
2136
  *
2137
2137
  * @returns {Boolean} True if the loader was found
@@ -2196,7 +2196,7 @@
2196
2196
  *
2197
2197
  * @param {String} requestId The unique ID of the request as used in bbn.env.loaders
2198
2198
  *
2199
- * @returns {false|Object} The corresponding loader Object if it exists, false otherwise
2199
+ * @returns {null|Object} The corresponding loader Object if it exists, false otherwise
2200
2200
  */
2201
2201
  const getLoader = function (requestId) {
2202
2202
  let idx = (0, search_3.search)(bbn.env.loaders, { key: requestId });
@@ -3105,7 +3105,7 @@
3105
3105
  *
3106
3106
  * @returns {Promise} The Promise created by the generated XHR.
3107
3107
  */
3108
- const ajax = function (url, datatype, data, success, failure, abort) {
3108
+ const ajax = function (url, datatype = null, data = null, success = null, failure = null, abort = null) {
3109
3109
  if (arguments.length === 1 && url && typeof url === "object" && url.url) {
3110
3110
  if (url.abort) {
3111
3111
  abort = url.abort;
@@ -3151,7 +3151,7 @@
3151
3151
  cancelToken: source.token,
3152
3152
  };
3153
3153
  if (datatype === "text") {
3154
- options.headers = {
3154
+ options['headers'] = {
3155
3155
  accept: "text/javascript",
3156
3156
  "Content-Type": "text/javascript",
3157
3157
  };
@@ -3728,7 +3728,7 @@
3728
3728
  *
3729
3729
  * @returns {*} The result of the main callback function: res.script, fn, or bbn.fn.defaultLinkFunction
3730
3730
  */
3731
- const callback = function (url, res, fn = null, fn2 = null, ele = null) {
3731
+ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
3732
3732
  let tmp = false;
3733
3733
  if (res) {
3734
3734
  tmp = true;
@@ -4926,7 +4926,7 @@
4926
4926
  *
4927
4927
  * @returns {undefined}
4928
4928
  */
4929
- const downloadContent = function (filename, content, type) {
4929
+ const downloadContent = function (filename, content, type = null) {
4930
4930
  if ((0, isCanvas_1.isCanvas)(content)) {
4931
4931
  content.toBlob((blob) => {
4932
4932
  // blob ready, download it
@@ -6704,7 +6704,7 @@
6704
6704
  */
6705
6705
  const link = function (...args) {
6706
6706
  let cfg = (0, treatAjaxArguments_1.treatAjaxArguments)(args);
6707
- let ok = true;
6707
+ let ok = 1;
6708
6708
  /* If we can't find a correct link we load the current URL */
6709
6709
  if (!cfg) {
6710
6710
  return link(window.location.href);
@@ -6756,9 +6756,9 @@
6756
6756
  ok = cfg.successFn(cfg.url);
6757
6757
  }
6758
6758
  else if (bbn.fn.defaultPreLinkFunction) {
6759
- ok = bbn.fn.defaultPreLinkFunction(cfg.url, cfg.force, cfg.ele);
6760
- if (ok.data !== undefined) {
6761
- (0, extend_6.extend)(cfg.obj, ok.data);
6759
+ let tmp = bbn.fn.defaultPreLinkFunction(cfg.url, cfg.force, cfg.ele);
6760
+ if (tmp.data !== undefined) {
6761
+ (0, extend_6.extend)(cfg.obj, tmp.data);
6762
6762
  ok = 1;
6763
6763
  }
6764
6764
  }
@@ -7,10 +7,10 @@
7
7
  * @memberof bbn.fn
8
8
  *
9
9
  * @param {String} requestId The unique ID of the request sent
10
- * @param {*} res The result of the request
10
+ * @param {String|Object} res The result of the request
11
11
  * @param {Boolean} isAbort True if the deletion comes from abortion
12
12
  *
13
13
  * @returns {Boolean} True if the loader was found
14
14
  */
15
- declare const _deleteLoader: (requestId: string, res?: any, isAbort?: boolean) => boolean;
15
+ declare const _deleteLoader: (requestId: any, res?: any, isAbort?: boolean) => boolean;
16
16
  export { _deleteLoader };
@@ -10,7 +10,7 @@ import { isObject } from '../type/isObject';
10
10
  * @memberof bbn.fn
11
11
  *
12
12
  * @param {String} requestId The unique ID of the request sent
13
- * @param {*} res The result of the request
13
+ * @param {String|Object} res The result of the request
14
14
  * @param {Boolean} isAbort True if the deletion comes from abortion
15
15
  *
16
16
  * @returns {Boolean} True if the loader was found
@@ -54,5 +54,5 @@
54
54
  *
55
55
  * @returns {Promise} The Promise created by the generated XHR.
56
56
  */
57
- declare const ajax: (url: any, datatype: string, data: any, success?: (data: object, headers?: object) => any, failure?: (url: string, o?: object) => any, abort?: (message: string, url: string) => any) => any;
57
+ declare const ajax: (url: any, datatype?: any, data?: any, success?: any, failure?: any, abort?: any) => any;
58
58
  export { ajax };
@@ -63,7 +63,7 @@ import { _addLoader } from "./_addLoader";
63
63
  *
64
64
  * @returns {Promise} The Promise created by the generated XHR.
65
65
  */
66
- const ajax = function (url, datatype, data, success, failure, abort) {
66
+ const ajax = function (url, datatype = null, data = null, success = null, failure = null, abort = null) {
67
67
  if (arguments.length === 1 && url && typeof url === "object" && url.url) {
68
68
  if (url.abort) {
69
69
  abort = url.abort;
@@ -109,7 +109,7 @@ const ajax = function (url, datatype, data, success, failure, abort) {
109
109
  cancelToken: source.token,
110
110
  };
111
111
  if (datatype === "text") {
112
- options.headers = {
112
+ options['headers'] = {
113
113
  accept: "text/javascript",
114
114
  "Content-Type": "text/javascript",
115
115
  };
@@ -33,5 +33,5 @@
33
33
  *
34
34
  * @returns {*} The result of the main callback function: res.script, fn, or bbn.fn.defaultLinkFunction
35
35
  */
36
- declare const callback: (url: any, res: any, fn?: any, fn2?: any, ele?: any) => boolean;
36
+ declare const callback: (url: any, res?: any, fn?: any, fn2?: any, ele?: any) => boolean;
37
37
  export { callback };
@@ -36,7 +36,7 @@ import { log } from '../browser/log';
36
36
  *
37
37
  * @returns {*} The result of the main callback function: res.script, fn, or bbn.fn.defaultLinkFunction
38
38
  */
39
- const callback = function (url, res, fn = null, fn2 = null, ele = null) {
39
+ const callback = function (url, res = null, fn = null, fn2 = null, ele = null) {
40
40
  let tmp = false;
41
41
  if (res) {
42
42
  tmp = true;
@@ -24,5 +24,5 @@
24
24
  *
25
25
  * @returns {undefined}
26
26
  */
27
- declare const downloadContent: (filename: string, content: any, type?: string) => void;
27
+ declare const downloadContent: (filename: any, content: any, type?: any) => void;
28
28
  export { downloadContent };
@@ -28,7 +28,7 @@ import { log } from '../browser/log';
28
28
  *
29
29
  * @returns {undefined}
30
30
  */
31
- const downloadContent = function (filename, content, type) {
31
+ const downloadContent = function (filename, content, type = null) {
32
32
  if (isCanvas(content)) {
33
33
  content.toBlob((blob) => {
34
34
  // blob ready, download it
@@ -31,7 +31,7 @@
31
31
  *
32
32
  * @param {String} requestId The unique ID of the request as used in bbn.env.loaders
33
33
  *
34
- * @returns {false|Object} The corresponding loader Object if it exists, false otherwise
34
+ * @returns {null|Object} The corresponding loader Object if it exists, false otherwise
35
35
  */
36
- declare const getLoader: (requestId: string) => BbnLoader | null;
36
+ declare const getLoader: (requestId: any) => BbnLoader;
37
37
  export { getLoader };
@@ -32,7 +32,7 @@ import { search } from '../object/search';
32
32
  *
33
33
  * @param {String} requestId The unique ID of the request as used in bbn.env.loaders
34
34
  *
35
- * @returns {false|Object} The corresponding loader Object if it exists, false otherwise
35
+ * @returns {null|Object} The corresponding loader Object if it exists, false otherwise
36
36
  */
37
37
  const getLoader = function (requestId) {
38
38
  let idx = search(bbn.env.loaders, { key: requestId });
@@ -32,7 +32,7 @@ import { setNavigationVars } from './setNavigationVars';
32
32
  */
33
33
  const link = function (...args) {
34
34
  let cfg = treatAjaxArguments(args);
35
- let ok = true;
35
+ let ok = 1;
36
36
  /* If we can't find a correct link we load the current URL */
37
37
  if (!cfg) {
38
38
  return link(window.location.href);
@@ -84,9 +84,9 @@ const link = function (...args) {
84
84
  ok = cfg.successFn(cfg.url);
85
85
  }
86
86
  else if (bbn.fn.defaultPreLinkFunction) {
87
- ok = bbn.fn.defaultPreLinkFunction(cfg.url, cfg.force, cfg.ele);
88
- if (ok.data !== undefined) {
89
- extend(cfg.obj, ok.data);
87
+ let tmp = bbn.fn.defaultPreLinkFunction(cfg.url, cfg.force, cfg.ele);
88
+ if (tmp.data !== undefined) {
89
+ extend(cfg.obj, tmp.data);
90
90
  ok = 1;
91
91
  }
92
92
  }
package/dist/fn.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  declare const fn: {
2
2
  _addLoader: (requestId: any, prom: any, source: any) => number;
3
3
  _compareValues: (a: any, b: any, prop: any, dir?: string) => 0 | 1 | -1;
4
- _deleteLoader: (requestId: string, res?: any, isAbort?: boolean) => boolean;
4
+ _deleteLoader: (requestId: any, res?: any, isAbort?: boolean) => boolean;
5
5
  abort: (requestId: any) => void;
6
6
  abortURL: (url: any) => void;
7
7
  addColors: (colors: object) => void;
@@ -10,7 +10,7 @@ declare const fn: {
10
10
  adjustHeight: () => void;
11
11
  adjustSize: (type: any, eles: any) => void;
12
12
  adjustWidth: () => void;
13
- ajax: (url: any, datatype: string, data: any, success?: (data: object, headers?: object) => any, failure?: (url: string, o?: object) => any, abort?: (message: string, url: string) => any) => any;
13
+ ajax: (url: any, datatype?: any, data?: any, success?: any, failure?: any, abort?: any) => any;
14
14
  analyzeFunction: (fn: any) => {
15
15
  body: any;
16
16
  args: any[];
@@ -28,7 +28,7 @@ declare const fn: {
28
28
  baseName: (path: string, suffix?: string) => string;
29
29
  br2nl: (st: any) => string;
30
30
  calendar: (d?: string | number | Date, wrong_result?: string) => any;
31
- callback: (url: any, res: any, fn?: any, fn2?: any, ele?: any) => boolean;
31
+ callback: (url: any, res?: any, fn?: any, fn2?: any, ele?: any) => boolean;
32
32
  camelize: (str: any) => any;
33
33
  camelToCss: (str: any) => any;
34
34
  canvasToImage: (canvas: any) => HTMLImageElement;
@@ -68,7 +68,7 @@ declare const fn: {
68
68
  diffObj: (obj1: object, obj2: object, unchanged?: boolean, notRoot?: boolean) => any;
69
69
  dirName: (path: any) => string;
70
70
  download: (url: any, filename?: string, params?: any) => any;
71
- downloadContent: (filename: string, content: any, type?: string) => void;
71
+ downloadContent: (filename: any, content: any, type?: any) => void;
72
72
  each: (arr: any, fn: any) => any;
73
73
  eraseCookie: (name: any) => void;
74
74
  error: (errorMsg: any) => never;
@@ -109,7 +109,7 @@ declare const fn: {
109
109
  getFieldValues: (arr: object[], field: string, prop: any, val: any, operator: any) => any[];
110
110
  getHtml: (ele: any, stripComments?: boolean) => any;
111
111
  getHTMLOfSelection: () => string;
112
- getLoader: (requestId: string) => BbnLoader;
112
+ getLoader: (requestId: any) => BbnLoader;
113
113
  getPath: (element: any) => string;
114
114
  getProp: (obj: any, prop: any) => any;
115
115
  getProperty: (obj: any, prop: any) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.83",
3
+ "version": "1.0.84",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",