Skip to content

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

Merged
merged 2 commits into from
Sep 21, 2021
Merged

Conversation

yuvipanda
Copy link
Collaborator

@yuvipanda yuvipanda commented Sep 20, 2021

For badge.js:

For badge.js:

  • Stop using global constants for config.
  • Use a single function that can switch on syntax type, rather than unique functions for
    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

- 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
@yuvipanda yuvipanda mentioned this pull request Sep 20, 2021
6 tasks
@yuvipanda
Copy link
Collaborator Author

The test failures seem completely unrelated?

Pathway towards making the functions more testable
@yuvipanda yuvipanda changed the title Slightly cleanup BadgeImage class Slightly cleanup 2 js files Sep 20, 2021
@yuvipanda
Copy link
Collaborator Author

image

definitely looks unrelated

Copy link
Member

@consideRatio consideRatio left a 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!!!

@yuvipanda
Copy link
Collaborator Author

@consideRatio do you know why the pre-commit.ci PR is failing?

@consideRatio
Copy link
Member

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.

@consideRatio consideRatio merged commit 69833c2 into jupyterhub:master Sep 21, 2021
@consideRatio
Copy link
Member

Thanks yuvi!!!

consideRatio pushed a commit to jupyterhub/helm-chart that referenced this pull request Sep 21, 2021
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.

2 participants