Socket
Book a DemoInstallSign in
Socket

@widergy/polling-handling

Package Overview
Dependencies
Maintainers
7
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@widergy/polling-handling

Utility GO! Polling Handling

2.1.1
latest
Source
npmnpm
Version published
Weekly downloads
33
-58.23%
Maintainers
7
Weekly downloads
 
Created
Source

Polling Handling Logo

WidergyWeb PackageSize semantic-release

< Hello! can you give me the user data?
> Hi, I don't have that information, but my friend 83abb91c-31f0-4be6-9b8b-88cbf716c can get it for you.
< Mmm... ok.. Hey 83abb91c-31f0-4be6-9b8b-88cbf716c can you give me the user data?
> Processing
< 🤔 Ok ... now?
> Processing
< 🤔 Ok ... now?
> Processing
< 😒 now?
> OK! { userInfo: ... }
< Great! 😁

Installing

npm install --save @widergy/polling-handling

yarn add @widergy/polling-handling

Basic usage

On application starts

import Polling from '@widergy/polling-handling';

class App extends Component {
  componentDidMount = () => {
    Polling.init('Polling endpoint base url, for example: http://apibaseurl.com/api/v1/async_request/jobs/');
  ....

When you need to consume a service with polling

import Polling from '@widergy/polling-handling';

// Service that triggers async worker generation 
const someService = parameters => api.get('/some_endpoint', parameters);

....
// When we need to consume that service, and poll the async worker to obtain info:
const response = await Polling.handle(someService(parameters));

Interface

Input

Polling.init(baseUrl)

  • baseUrl (Required): Endpoint base for all async jobs, then handle concats job id to this url.

Polling.handle(originalRequest, timeout)

  • originalRequest (Required): Api call that returns job code for poll.

  • timeout (Optional): For override the default timeout value (60000 milliseconds).

Output

If requests fails returns a response object with two keys:

  • error: Complete error details from api answer.
  • status: Status code from api answer.

If request finish ok, a response object with only one key:

  • data: Complete information from api answer.

License

MIT © Widergy

Keywords

widergy

FAQs

Package last updated on 25 Mar 2025

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.