-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX beta] Throw error if run.bind receives no method #16729
Conversation
d347b61
to
ae7fef6
Compare
packages/@ember/runloop/index.js
Outdated
export const bind = (...curried) => (...args) => join(...curried.concat(args)); | ||
export const bind = (...curried) => { | ||
if (!bindMethodPresent(...curried)) { | ||
throw new Error('could not find a suitable method to bind'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this an assertion and inline the bindMethodPresent
implementation in an IIFE as the predicate?
assert('Could not find a suitable method to bind.', (function() {
// guts of conditional below...
})());
No problem. I used an error because it was what was requested, but can
easily be done.
…On 8 June 2018 at 22:00:54, Robert Jackson ***@***.***) wrote:
***@***.**** commented on this pull request.
------------------------------
In ***@***.***/runloop/index.js
<#16729 (comment)>:
> @@ -217,7 +217,39 @@ export function join() {
@SInCE 1.4.0
@public
*/
-export const bind = (...curried) => (...args) => join(...curried.concat(args));
+export const bind = (...curried) => {
+ if (!bindMethodPresent(...curried)) {
+ throw new Error('could not find a suitable method to bind');
Can we make this an assertion and inline the bindMethodPresent
implementation in an IIFE as the predicate?
assert('Could not find a suitable method to bind.', (function() {
// guts of conditional below...
})());
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#16729 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACNfZQbH_6vesaZj8ZkL4TtPQDQsnPMks5t6tf2gaJpZM4UgjhZ>
.
|
Yeah, sorry about that. I had forgotten just how complicated the argument munging is for |
ae7fef6
to
5b22bf5
Compare
This commit uses the same logic as backburner.join to know which method is being bound. Fixes emberjs#16652
5b22bf5
to
3329f09
Compare
Done! |
Thank you!! |
This commit uses the same logic as backburner.join to know
which method is being bound.
Fixes #16652