-
Notifications
You must be signed in to change notification settings - Fork 395
Slightly cleanup 2 js files #1382
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
Conversation
- Use ES6 classes - Don't reach into the DOM to get build token and baseUrl. This will help with writing tests in the future - Use => functions, so we can stop writing `const that = this`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions. Particularly, it does not rebind `this`, so we can continue to access the parent context's `this`. Eventually this could be part of a binder-client JS package that can be used by other projects (like thebe) Ref jupyterhub#1373
The test failures seem completely unrelated? |
Pathway towards making the functions more testable
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.
Beautiful!
I spent quite a bit of time to look at this to compensate for me not being so fluent with ES6 / JS matters. I think this is good to go.
The test failures relates to k3s-io/k3s#4054 btw. While unrelated, they fail and block the actual tests that are relevant to see still work. I suggest we wait a while to see if they solve the k3s issue - I think at least it will be solved within 24 hours.
Amazing work @yuvipanda!!!
@consideRatio do you know why the pre-commit.ci PR is failing? |
Because it doesnt see a pre-commit config yet, ignore it for now. I enabled it for this repo for the pre-commit related pr. |
Thanks yuvi!!! |
jupyterhub/binderhub#1382 Merge pull request #1382 from yuvipanda/new-class
For badge.js:
This will help with writing tests in the future
const that = this
.See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions.
Particularly, it does not rebind
this
, so we can continueto access the parent context's
this
.For badge.js:
each syntax. Helps reduce boilerplate.
Eventually this could be part of a binder-client JS package that
can be used by other projects (like thebe)
Ref #1373