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

Add support for browser environments #134

Merged
merged 1 commit into from
Jan 30, 2018
Merged

Add support for browser environments #134

merged 1 commit into from
Jan 30, 2018

Conversation

leebyron
Copy link
Contributor

The secret sauce of this library is enqueuePostPromiseJob, which relies on node.js behavior of process.nextTick to behave correctly. Browsers must use a macro-task to achieve similarly correct behavior, though it may have performance implications.

Closes #112

The secret sauce of this library is `enqueuePostPromiseJob`, which relies on node.js behavior of process.nextTick to behave correctly. Browsers must use a macro-task to achieve similarly correct behavior, though it may have performance implications.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 95e8451 on browser-support into 7404ab2 on master.

@leebyron leebyron merged commit 49e2659 into master Jan 30, 2018
@leebyron leebyron deleted the browser-support branch January 30, 2018 21:28
}
resolvedPromise.then(() => process.nextTick(fn));
} :
setImmediate || setTimeout;
Copy link

@shivijais shivijais Feb 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leebyron This will throw error in browsers which do not support setImmediate. SetImmediate polyfill is mandatory for this code to work. Something like this would be better
(typeof setImmediate !== 'undefined' ? setImmediate : setTimeout)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just got bitten by this. @leebyron

Copy link

@xealot xealot Nov 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye, same. Care here and saw this. Is this still not addressed?

To anyone using CoreJS, a workaround:

import 'core-js/web/immediate';

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

Successfully merging this pull request may close these issues.

5 participants