ajax-best-promise 0.4.0 → 0.4.3
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/README.md +4 -43
- package/package.json +26 -35
package/README.md
CHANGED
|
@@ -5,10 +5,10 @@ Ajax with best promise - Ajax with stream data
|
|
|
5
5
|
|
|
6
6
|

|
|
7
7
|
[](https://npmjs.org/package/ajax-best-promise)
|
|
8
|
+
[](https://github.com/codenautas/ajax-best-promise/actions/workflows/node.js.yml)
|
|
8
9
|
[](https://npmjs.org/package/ajax-best-promise)
|
|
9
|
-
[](https://david-dm.org/codenautas/ajax-best-promise)
|
|
10
|
+
[](https://github.com/codenautas/ajax-best-globals/pulls/app%2Fdependabot)
|
|
11
|
+
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
language: 
|
|
@@ -56,26 +56,6 @@ AjaxBestPromise.get({
|
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
## haders
|
|
60
|
-
|
|
61
|
-
You can send headers in the header property and recieve it with the `onHeader` function.
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
AjaxBestPromise.put({
|
|
65
|
-
url:'http://example.com:3333/service/',
|
|
66
|
-
data:{ alfa: 1, betha: 2},
|
|
67
|
-
headers:{
|
|
68
|
-
Authorization: 'Bearer ' + token
|
|
69
|
-
}
|
|
70
|
-
}).onHeaders(function(headers){
|
|
71
|
-
newId = headers.Location;
|
|
72
|
-
}).then(function(){
|
|
73
|
-
console.log('data inserted', newId);
|
|
74
|
-
}).catch(function(err){
|
|
75
|
-
console.log('error inserting data', err);
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
59
|
|
|
80
60
|
## Error handler
|
|
81
61
|
|
|
@@ -94,28 +74,9 @@ AjaxBestPromise.get({
|
|
|
94
74
|
});
|
|
95
75
|
```
|
|
96
76
|
|
|
97
|
-
## Modern JS
|
|
98
|
-
|
|
99
|
-
```ts
|
|
100
|
-
try{
|
|
101
|
-
var newId: string
|
|
102
|
-
await AjaxBestPromise.put({
|
|
103
|
-
url:'http://example.com:3333/service/',
|
|
104
|
-
data:{ alfa: 1, betha: 2},
|
|
105
|
-
headers:{
|
|
106
|
-
Authorization: 'Bearer ' + token
|
|
107
|
-
}
|
|
108
|
-
}).onHeaders(function(headers){
|
|
109
|
-
newId = headers.Location;
|
|
110
|
-
});
|
|
111
|
-
console.log('data inserted', newId);
|
|
112
|
-
}catch(err){
|
|
113
|
-
console.log('error inserting data', err);
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
77
|
## Tests with real devices
|
|
118
78
|
|
|
79
|
+
|
|
119
80
|
NPM version |Device |OS |nav |obs
|
|
120
81
|
------------|-----------------------|---------------|-------------------------|----
|
|
121
82
|
0.1.3 | Samsung Galaxy Note 4 | Android 6.0.1 | Chrome Mobile 44.0.2403 |
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ajax-best-promise",
|
|
3
3
|
"description": "Ajax with best promise - Ajax with stream data",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.3",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
@@ -21,47 +21,38 @@
|
|
|
21
21
|
"main": "bin/ajax-best-promise.js",
|
|
22
22
|
"dependencies": {},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"body-parser": "
|
|
25
|
-
"cookie-parser": "
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"express": "
|
|
29
|
-
"express-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"karma": "
|
|
34
|
-
"karma-
|
|
35
|
-
"karma-
|
|
36
|
-
"karma-
|
|
37
|
-
"karma-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"mini-tools": "~1.12.0",
|
|
47
|
-
"require-bro": "~0.3.1",
|
|
48
|
-
"serve-content": "~0.3.18"
|
|
24
|
+
"body-parser": "^2.2.2",
|
|
25
|
+
"cookie-parser": "^1.4.7",
|
|
26
|
+
"expect.js": "^0.3.1",
|
|
27
|
+
"express": "^5.2.1",
|
|
28
|
+
"express-session": "^1.19.0",
|
|
29
|
+
"express-useragent": "^2.1.0",
|
|
30
|
+
"fs-promise": "^2.0.3",
|
|
31
|
+
"istanbul": "^0.4.5",
|
|
32
|
+
"karma": "^6.4.4",
|
|
33
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
34
|
+
"karma-coverage": "^2.2.1",
|
|
35
|
+
"karma-expect": "^1.1.3",
|
|
36
|
+
"karma-firefox-launcher": "^2.1.3",
|
|
37
|
+
"karma-mocha": "^2.0.1",
|
|
38
|
+
"mocha": "^11.7.5",
|
|
39
|
+
"moment": "^2.30.1",
|
|
40
|
+
"multiparty": "^4.2.3",
|
|
41
|
+
"pug": "^3.0.3",
|
|
42
|
+
"read-yaml-promise": "^1.0.2",
|
|
43
|
+
"mini-tools": "^1.13.4",
|
|
44
|
+
"require-bro": "^0.3.2",
|
|
45
|
+
"serve-content": "^1.0.2"
|
|
49
46
|
},
|
|
50
47
|
"engines": {
|
|
51
|
-
"node": ">=
|
|
48
|
+
"node": ">= 16"
|
|
52
49
|
},
|
|
53
50
|
"scripts": {
|
|
54
51
|
"infinito": "node examples/server/server.js --karma karma.conf.js",
|
|
55
|
-
"test": "
|
|
52
|
+
"test": "echo Use test-ui to test!",
|
|
53
|
+
"test-ui": "node examples/server/server.js --karma karma.conf.js --single-run",
|
|
56
54
|
"test-cov": "node examples/server/server.js --karma karma.conf.js --single-run",
|
|
57
55
|
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
|
58
56
|
"start": "node examples/server/server.js"
|
|
59
|
-
},
|
|
60
|
-
"qa-control": {
|
|
61
|
-
"package-version": "0.3.0",
|
|
62
|
-
"coverage": 90,
|
|
63
|
-
"run-in": "both",
|
|
64
|
-
"stability": "extending",
|
|
65
|
-
"type": "lib"
|
|
66
57
|
}
|
|
67
58
|
}
|