ajax-best-promise 0.4.0 → 0.4.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.
- package/README.md +1 -43
- package/package.json +24 -34
package/README.md
CHANGED
|
@@ -6,9 +6,6 @@ Ajax with best promise - Ajax with stream data
|
|
|
6
6
|

|
|
7
7
|
[](https://npmjs.org/package/ajax-best-promise)
|
|
8
8
|
[](https://npmjs.org/package/ajax-best-promise)
|
|
9
|
-
[](https://travis-ci.org/codenautas/ajax-best-promise)
|
|
10
|
-
[](https://coveralls.io/r/codenautas/ajax-best-promise)
|
|
11
|
-
[](https://david-dm.org/codenautas/ajax-best-promise)
|
|
12
9
|
|
|
13
10
|
|
|
14
11
|
language: 
|
|
@@ -56,26 +53,6 @@ AjaxBestPromise.get({
|
|
|
56
53
|
});
|
|
57
54
|
```
|
|
58
55
|
|
|
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
56
|
|
|
80
57
|
## Error handler
|
|
81
58
|
|
|
@@ -94,28 +71,9 @@ AjaxBestPromise.get({
|
|
|
94
71
|
});
|
|
95
72
|
```
|
|
96
73
|
|
|
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
74
|
## Tests with real devices
|
|
118
75
|
|
|
76
|
+
|
|
119
77
|
NPM version |Device |OS |nav |obs
|
|
120
78
|
------------|-----------------------|---------------|-------------------------|----
|
|
121
79
|
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.2",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
@@ -21,34 +21,31 @@
|
|
|
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": "^1.20.2",
|
|
25
|
+
"cookie-parser": "^1.4.6",
|
|
26
|
+
"expect.js": "^0.3.1",
|
|
27
|
+
"express": "^4.19.2",
|
|
28
|
+
"express-session": "^1.18.0",
|
|
29
|
+
"express-useragent": "^1.0.15",
|
|
30
|
+
"fs-promise": "^2.0.3",
|
|
31
|
+
"istanbul": "^0.4.5",
|
|
32
|
+
"karma": "^6.4.3",
|
|
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": "^10.4.0",
|
|
39
|
+
"moment": "^2.30.1",
|
|
40
|
+
"multiparty": "^4.2.3",
|
|
41
|
+
"pug": "^3.0.2",
|
|
42
|
+
"read-yaml-promise": "^1.0.2",
|
|
43
|
+
"mini-tools": "^1.12.1",
|
|
44
|
+
"require-bro": "^0.3.1",
|
|
45
|
+
"serve-content": "^0.3.19"
|
|
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",
|
|
@@ -56,12 +53,5 @@
|
|
|
56
53
|
"test-cov": "node examples/server/server.js --karma karma.conf.js --single-run",
|
|
57
54
|
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
|
58
55
|
"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
56
|
}
|
|
67
57
|
}
|