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

Advice on how to write a plugin for inline or async data operations (e.g. promises) #60

Open
droplab opened this issue Jul 8, 2016 · 1 comment

Comments

@droplab
Copy link

droplab commented Jul 8, 2016

Hi, have been using this library for years - thanks for the efforts on this. I've been mulling over whether it's possible for a plugin to handle asynchronous/promise operations? A couple of use cases:

  • I'm pulling data asynchronously from a remote api, I want pxloader to wait for the data to come in. I just saw that there is a PxLoaderData plugin for this use case.
  • I'm running internal data handling logic that involves the use of a promise. I want pxloader to wait for the promise to resolve.

I took a quick look at some of the existing plugins but didn't have time to dig into them. I imagine others must have this same use case in their apps. So my question at this point is, what is the best approach here: write a custom plugin that ties all of this into pxloader or handle these types of async/promise operations outside of pxloader?

If it's the latter, the issue is then how to seamlessly integrate into pxloader's progress/complete logic and handlers?

Thanks in advance for any guidance/info on this.

@droplab
Copy link
Author

droplab commented Jul 8, 2016

Howdy, I was able to write a plugin for this -- ended up being pretty easy. Let me know if you want me to do a pull request if you think this is useful for anyone else. Cheers

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