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
Javascript code needs reviewed #32
Comments
I'm not really a front-end dev but I will try to help 😄 |
I'll have a look. I've worked in frontend development. |
@raidancampbell @cgutman What are your thoughts on moving to EmberJS as a framework to work around? This way we have some standards to follow instead of just doing pure JS (and avoid using JQuery directly). |
I have no preferences on the matter. I'm slightly weary of bringing in an additional framework. Would this completely replace JQuery? @dead do you have any thoughts on the matter? |
@raidancampbell Most JS frameworks now-a-days are built on top of JQuery, though I would have to check about Ember. I'm just looking to use something a little more structured is all. |
I like the idea of using Ember 👍 Just be careful in removing JQuery because NvHTTP uses it (https://github.com/moonlight-stream/moonlight-chrome/blob/master/static/js/utils.js#L204) |
sounds good to me, then |
I was reviewing the index.js file but my windows went full retard and I lost the file 😢 The thing that most annoy me is
In the
The And the pooling doesn't make any sense to me. Every server has a timer to update itself? The hosts should be updated by only one global timer. And the apps should be only updated if you are in the 'showAppsMode'. About Ember or other frameworks, I don't think they are really needed for this project. They only will increase the dependency to compile and develop. |
I fully agree with your points that I took a half-assed stab at removing the global The polling was again an implementation choice: it never occurred to me to have one timer firing for a globally shared list of hosts. This is something I'll look into. Again, thanks for your help. Your javascript insight is very valuable to me. |
@dead now I'm remembering why I didn't structure the so let's use the exact version I wrote as a sample:
if I click the addHost button (and therefore run this function), then hit the cancel button, each of the With the global event listener attachment, I avoided this problem. Do you have a trick to avoid the problem here? |
I don't think it's different when using the global handler. For each time you click in addHost you will have only one function that will be called when clicking in the cancel or continue button. |
Perhaps "global" is the wrong word. when I defined In this new I can push this code to a branch if you don't understand what I mean. |
Oh, now I understand it! I was thinking that .on('click') would replace the older event handler, but it does not! |
…tly tested, but bugs may have been introduced. Progress on #32
I reviewed most of the index.js code, you can check it in my fork: The changes are:
I think the code now is simpler and easier to understand. |
Have you tested this from scratch? I was unable to pair with your fork. Here's a paste of the JS log, I haven't had time to actually investigate this. The hostname I was pairing with is replaced with |
It's working fine locally, didn't test with a remote host. And I don't see the snackbar logs in your file, it should be there (https://github.com/dead/moonlight-chrome/blob/master/static/js/index.js#L791). |
Should we close this issue now that it is implemented? |
I've never done this Javascript stuff before, and I'm absolutely certain there are fundamental practices that I'm disobeying. It would be awesome if someone more experienced in Javascript could take a look at the code.
Javascript code is located in the static/js directory, and my main concern is the index.js file
The text was updated successfully, but these errors were encountered: