@ouroboros/body 1.0.6 → 1.1.2

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.
@@ -7,6 +7,7 @@
7
7
  * @copyright Ouroboros Coding Inc.
8
8
  * @created 2023-03-03
9
9
  */
10
+ import XMLHttpRequest from 'xhr2';
10
11
  import * as constants from './constants';
11
12
  import * as errors from './errors';
12
13
  import * as regex from './regex';
@@ -136,9 +137,9 @@ declare class Body {
136
137
  */
137
138
  onError(callback: onError): void;
138
139
  /**
139
- * On No Session
140
+ * On Error Code
140
141
  *
141
- * Sets callback for whenever a request gets a REST_AUTHORIZATION error
142
+ * Sets callback for whenever a request gets an error back
142
143
  *
143
144
  * @name onNoSession
144
145
  * @access public
@@ -7,6 +7,8 @@
7
7
  * @copyright Ouroboros Coding Inc.
8
8
  * @created 2023-03-03
9
9
  */
10
+ // NPM modules
11
+ import XMLHttpRequest from 'xhr2';
10
12
  // Import const files
11
13
  import * as constants from './constants';
12
14
  import * as errors from './errors';
@@ -107,7 +109,7 @@ class Body {
107
109
  handleError(`${ACTIONS_TO_METHODS[action]} ${url} failed to connect`);
108
110
  });
109
111
  // Handle successful request
110
- xhr.addEventListener('load', (event) => {
112
+ xhr.addEventListener('load', event => {
111
113
  if (this.verbose) {
112
114
  console.log(`xhr.load:\n\t${ACTIONS_TO_METHODS[action]} ${url}\n\t`, event);
113
115
  }
@@ -156,7 +158,7 @@ class Body {
156
158
  }
157
159
  });
158
160
  // Handle the request being finished
159
- xhr.addEventListener('loadend', (event) => {
161
+ xhr.addEventListener('loadend', event => {
160
162
  if (this.verbose) {
161
163
  console.log(`xhr.loadend:\n\t${ACTIONS_TO_METHODS[action]} ${url}\n\t`, event);
162
164
  }
@@ -271,9 +273,9 @@ class Body {
271
273
  this.error = callback;
272
274
  }
273
275
  /**
274
- * On No Session
276
+ * On Error Code
275
277
  *
276
- * Sets callback for whenever a request gets a REST_AUTHORIZATION error
278
+ * Sets callback for whenever a request gets an error back
277
279
  *
278
280
  * @name onNoSession
279
281
  * @access public
@@ -0,0 +1,3 @@
1
+ declare module "xhr2" {
2
+ export default XMLHttpRequest;
3
+ }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@ouroboros/body",
3
- "version": "1.0.6",
3
+ "version": "1.1.2",
4
4
  "description": "Classes to communicate with Ouroboros Coding Inc. body services",
5
- "main": "src/index.js",
6
- "types": "src/index.d.ts",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
7
  "scripts": {
8
- "build": "tslint -p tsconfig.json && tsc",
9
- "clean": "rm src/*.js src/*.d.ts",
10
- "for_local": "npm install; tslint -p tsconfig.json && tsc; rm -Rf node_modules",
11
- "test": "echo \"Error: no test specified.\" && exit 1"
12
- },
8
+ "build": "tslint -p tsconfig.json && tsc",
9
+ "clean": "rm build/*",
10
+ "for_local": "npm install; tslint -p tsconfig.json && tsc; rm -Rf node_modules",
11
+ "test": "echo \"Error: no test specified.\" && exit 1"
12
+ },
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git+https://github.com/ouroboroscoding/body-js.git"
@@ -28,6 +28,7 @@
28
28
  "tslint-config-prettier": "^1.18.0",
29
29
  "typescript": "^4.8.3"
30
30
  },
31
- "dependencies": {},
32
- "peerDependencies": {}
33
- }
31
+ "dependencies": {
32
+ "xhr2": "^0.2.1"
33
+ }
34
+ }
package/src/index.ts CHANGED
@@ -8,6 +8,9 @@
8
8
  * @created 2023-03-03
9
9
  */
10
10
 
11
+ // NPM modules
12
+ import XMLHttpRequest from 'xhr2';
13
+
11
14
  // Import const files
12
15
  import * as constants from './constants';
13
16
  import * as errors from './errors';
@@ -171,7 +174,7 @@ class Body {
171
174
  });
172
175
 
173
176
  // Handle successful request
174
- xhr.addEventListener('load', (event) => {
177
+ xhr.addEventListener('load', event => {
175
178
  if(this.verbose) {
176
179
  console.log(`xhr.load:\n\t${ACTIONS_TO_METHODS[action]} ${url}\n\t`, event);
177
180
  }
@@ -232,7 +235,7 @@ class Body {
232
235
  });
233
236
 
234
237
  // Handle the request being finished
235
- xhr.addEventListener('loadend', (event) => {
238
+ xhr.addEventListener('loadend', event => {
236
239
  if(this.verbose) {
237
240
  console.log(`xhr.loadend:\n\t${ACTIONS_TO_METHODS[action]} ${url}\n\t`, event);
238
241
  }
@@ -0,0 +1,3 @@
1
+ declare module "xhr2" {
2
+ export default XMLHttpRequest;
3
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes