0.4.2 • Published 2 years ago

ajax-best-promise v0.4.2

Weekly downloads
5
License
MIT
Repository
github
Last release
2 years ago

ajax-best-promise

Ajax with best promise - Ajax with stream data

extending npm-version downloads

language: English also available in: Spanish

Instalation

This is a client-side module. Download here

Use

AjaxBestPromise.get({
    url:'http://example.com:3333/service/do.php',
    data:{ alfa: 1, betha: 2}
}).then(function(result){
    console.log(result);
}).catch(function(err){
    console.log(err);
});

Chunked data

The main adventage of ajax-best-promise is the ability for process partial data in three flavors: onChunk, onLine, onJson

AjaxBestPromise.get({
    url:'http://example.com:3333/service/do.php',
    data:{ alfa: 1, betha: 2}
}).onChunk(function(partialText){
    console.log(partialText);
}).then(function(){
    console.log('done!');
}).catch(function(err){
    console.log(err);
});

Error handler

Other adventage of ajax-best-promise is the ability for reconstruct the error object.

AjaxBestPromise.get({
    url:'http://inexistent.com.ux/',
    data:{ alfa: 1, betha: 2}
}).then(function(result){
    console.log(result);
}).catch(function(err){
    console.log(err); // 404 Cannot GET inexistent.com.ux
    console.log(err.status); // 404
});

Tests with real devices

NPM versionDeviceOSnavobs
0.1.3Samsung Galaxy Note 4Android 6.0.1Chrome Mobile 44.0.2403
0.1.3iPad mini RetinaiOS 8.4.0Mobile Safari 8.0.0
0.1.3VMWareWinXPIE 8.0.0polyfill:many - fail:line stream & json stream

Licence

MIT

0.4.2

2 years ago

0.4.0

3 years ago

0.3.7

7 years ago

0.3.6

7 years ago

0.3.5

7 years ago

0.3.4

8 years ago

0.3.3

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.3

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago