-
Notifications
You must be signed in to change notification settings - Fork 624
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
Save Network in a cookie #223
base: master
Are you sure you want to change the base?
Conversation
to be able to store information beyond sessions
merging staging changes
But even if you were to use them, you declare them but never use them, and instead use the public Example: class Test {
#name
constructor(name) {
this.name = name;
this.#name = 'PRIVATE ' + name;
}
get privateName() {
return this.#name
}
}
var x = new Test('bob');
console.log(x.name)
// bob
console.log(x.privateName)
// PRIVATE bob |
|
Forgot that they we're still there...
Using localStorage makes much more sense in this case.
not used anymore
Did a bit of research on localStorage and came to the conclusion that in this case, it is the better way to do it. |
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.
This is only storing the network and causing the network to be "selected" on startup.
This ignores the possibility of a custom setup and a custom selection for API endpoints.
- Store all settings data.
- Restore it without triggering an event. Modify elements and variables. Maybe spread everything out into a function that can be used in the event handler and on boot when localStorage is present.
|
||
var o = ($("option:selected",this).attr("rel")).split(";"); | ||
optionSeleted = ($("option:selected",this).attr("rel")).split(";"); |
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.
no var
?
Also, s/optionSeleted/optionSelected/
@@ -1932,33 +1934,35 @@ $(document).ready(function() { | |||
}); | |||
|
|||
$("#coinjs_coin").change(function(){ | |||
// set localStorage for use after page (re)load | |||
localStorage.setItem(LOCALSTORAGE_COIN_KEY, $(this).val()); |
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.
What about the custom attributes?
@maxbethke Might worth to check out this PR as well #250, have added support for electrum servers as well. |
Related to issue #220
Issue:
Refer to #220
What has been done:
Created a class for saving cookies to be able to have the choice the user made for his network beyond page reloads.
What has changed:
Store the choosen dropdown option in a cookie.
Restore the previously choosen option when the page is loaded.