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

AsyncIdleComp - Create a IdleComp version that works with promises #1

Open
munizart opened this issue Oct 1, 2018 · 0 comments
Open
Labels
enhancement New feature or request Hacktoberfest help wanted Extra attention is needed

Comments

@munizart
Copy link
Owner

munizart commented Oct 1, 2018

IdleComp instances can handle any value very well:

IdleComp
  .of(5)
  .map(increment)
  .map(double)

Expect when it comes to Promises.

IdleComp
  .of(Promise.resolve(5))
  .map(increment) // NaN
  .map(double) // NaN

// Works, but only using idle time for scheduling promises micro-tasks
// that have higher precedence than macro-tasks (i.e user input) :(
IdleComp
  .of(Promise.resolve(5))
  .map(p => p.then(increment))
  .map(p => p.then(double))

We need a interface that can transform a chain into promise friendly, meaning that a AsynIdleComp will await until promises resolution and then schedule a idle computation.

@munizart munizart added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers Hacktoberfest and removed good first issue Good for newcomers labels Oct 1, 2018
@munizart munizart changed the title AsyncIdleComp AsyncIdleComp - Create a IdleComp version that works with promises Oct 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant