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

Initial reviewable code #1

Merged
merged 10 commits into from
May 21, 2018
Merged

Initial reviewable code #1

merged 10 commits into from
May 21, 2018

Conversation

alshakero
Copy link
Contributor

@alshakero alshakero commented May 16, 2018

@alshakero alshakero requested a review from tomalec May 16, 2018 11:40
.travis.yml Outdated
- npm install bower
- 'export PATH=$PWD/node_modules/.bin:$PATH'
- bower install
node_js: 6
Copy link
Member

Choose a reason for hiding this comment

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

I'd use 8 to be more up to dane.

README.md Outdated

> Handles palindrom-client disconnection events and creates the needed UI to give the user control over them

Custom Element that binds with [palindrom-client](https://github.com/Palindrom/palindrom-client) connection events and shows a simple UX that allows the user to interact with them. It is can be used as an example of designing your own error catcher.
Copy link
Member

Choose a reason for hiding this comment

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

"shows UI", I think experience is not the thing to show, is a thing to feel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right.

README.md Outdated

Custom Element that binds with [palindrom-client](https://github.com/Palindrom/palindrom-client) connection events and shows a simple UX that allows the user to interact with them. It is can be used as an example of designing your own error catcher.

Please check the code at `palindrom-error-catcher.html` file to see how events are handles.
Copy link
Member

Choose a reason for hiding this comment

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

"handled"

wct.conf.json Outdated
"sauce": {
"disabled": false,
"browsers": [{
"browserName": "firefox",
Copy link
Member

Choose a reason for hiding this comment

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

I think we should test in Edge as well. Plus we should be able to test firefox in "local"

this.cancelReloadingBtn = shadowRoot.querySelector('.cancel-reloading-btn');
this.reloadNowBtn = shadowRoot.querySelector('.reload-btn');

this.targetSelector = this.getAttribute('target-selector') || 'palindrom-client';
Copy link
Member

Choose a reason for hiding this comment

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

You should not read attributes in the constructor

this._bindCallbacks();
}
_bindToElement() {
this.target = this.getRootNode().querySelector(this.targetSelector);
Copy link
Member

Choose a reason for hiding this comment

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

I'dcheck in the document if there is none in the current root, as this element may be used in SD composition, there is no palindorm-client

_bindToElement() {
this.target = this.getRootNode().querySelector(this.targetSelector);
}
_bindCallbacks() {
Copy link
Member

Choose a reason for hiding this comment

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

I'd move it out of public API

@tomalec
Copy link
Member

tomalec commented May 16, 2018

Tests fail locally in FF for me
image
also, could you rename d-b-n_smoke/simple.html to something more applicable, we all forgot about dom-bind-notifier luckily ;)

@alshakero
Copy link
Contributor Author

Daaaamn! I had no idea d-b-n meant dom-bind-notifier. It was a huge mystery to me haha!

@tomalec
Copy link
Member

tomalec commented May 16, 2018

Could you add CONTRIBUTING.md, LICENSE, issue_template and make README.md more elaborate as in https://github.com/Juicy/juicy-element-boilerplate (usage, attributes, etc.)

this.genericErrorPane.addEventListener('click', reload);
this.subscribed = true;
}
_unsubscribeToEvents() {
Copy link
Member

Choose a reason for hiding this comment

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

I think those three _methods could also be hidden for public, to make sure nobody will start using them so we will be forced to support it ;)

Copy link
Contributor Author

@alshakero alshakero May 16, 2018

Choose a reason for hiding this comment

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

But this is extremely anti-pattern. They're part of the element class and I feel leaving them outside and passing parameters to them is like making static functions in a class and using them in another class once. This misses the point of the class altogether. I think the underscore should suffice to say that they're not part of the API. I mean I understand doing this for utility helper functions, but these functions are like life-cycle methods for the instance, doesn't feel right to keep them outside.

Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't say it's "extremely anti-pattern" it's opinionated, what is worse expose private methods as effectively public or define private methods outside of class keyword. There are just ways to address the problem, see more solutions at http://exploringjs.com/es6/ch_classes.html#sec_private-data-for-classes

You can see discussions like this in many places, like:
airbnb/javascript#1024

Personally, I think putting variably/function outside of published scope is and was the way to make them local/private in JavaScript since the very beginning, I don't like pretending JavaScript and its classes are like Java. Usually, I try to avoid quasi-/convention-based- private members as much as I can, unless I really need them for inheritance or smth. As I never trus convention to be reliable security guard.

Copy link
Member

Choose a reason for hiding this comment

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

Anyway, as I said to me it's just an opinion if you have the different one, go ahead, that was just my comment and suggestion. Failing FF, and lack of contributing are more blocking problems :)

@alshakero alshakero force-pushed the initial-reviewable-code branch from 5e93b39 to 8af681e Compare May 17, 2018 11:38
@alshakero
Copy link
Contributor Author

Should be ready

@alshakero alshakero force-pushed the initial-reviewable-code branch 2 times, most recently from fa07c85 to a51a4c7 Compare May 17, 2018 15:33
- Add contributing.md
- Add Gruntfile for auto version bumping
- Extend Readme.md
- Add issue template
@alshakero alshakero force-pushed the initial-reviewable-code branch from a51a4c7 to 5602c7d Compare May 17, 2018 15:36
@tomalec
Copy link
Member

tomalec commented May 17, 2018

Is it desired to change the behavior so it always reloads the page after few secs in case of the server crash? if so, then LGTM

Copy link
Member

@tomalec tomalec left a comment

Choose a reason for hiding this comment

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

Checked the code and tested with Kitchensink

@alshakero
Copy link
Contributor Author

Is it desired to change the behavior so it always reloads the page after few secs in case of the server crash? if so, then LGTM

Maybe I'm wrong, but isn't this what we do now?

@tomalec
Copy link
Member

tomalec commented May 18, 2018

You're right. Then it's 100% fine to me.

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