Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow it to provide a context to access the poller to force poll #31

Open
trajano opened this issue Jun 8, 2021 · 0 comments
Open

Allow it to provide a context to access the poller to force poll #31

trajano opened this issue Jun 8, 2021 · 0 comments

Comments

@trajano
Copy link

trajano commented Jun 8, 2021

I think you can use React context and provide some sort of API that would be used like

const { forcePoll, isPolling }  = useReactPolling("url");

// generally use the nicer method to check if it is already polling to wait for the poll to finish this could be the default
forcePoll({ method: "nice"} );
// Other methods
// forcePoll({ method: "force"} ); don't care, just re-execute the polling routine even if it is already running
// forcePoll({ method: "queue"} ); queue it up to poll after the current poll is done, calling multiple times will queue it up some more
// forcePoll({ method: "queue_once"} ); queue it up to poll after the current poll is done, calling multiple times will still only retain one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant