Socket
Socket
Sign inDemoInstall

ajax-best-promise

Package Overview
Dependencies
0
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ajax-best-promise

Ajax with best promise - Ajax with stream data


Version published
Maintainers
1
Install size
17.6 kB
Created

Readme

Source

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

FAQs

Last updated on 04 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc