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

Update satus.js limit writes to essential ones #2167

Merged
merged 4 commits into from
Apr 9, 2024

Conversation

raszpl
Copy link
Contributor

@raszpl raszpl commented Apr 8, 2024

Dont save storage if new value is same as old value. The way satus works the mere act of displaying for example themes performs useless redundant writes.
Stop radio from writing on every render
Actually save just the value saved, not everything
color picker no longer writes on every render

@ImprovedTube
Copy link
Member

(

every render
this.parentNode.storage.value = array;

*in future we might also use a color picker with one click and no OK button (could be smaller and part of the appearance section/minimap or anything)
)

@ImprovedTube ImprovedTube merged commit 8e41763 into code-charity:master Apr 9, 2024
@raszpl
Copy link
Contributor Author

raszpl commented Apr 9, 2024

*in future we might also use a color picker with one click and no OK button (could be smaller and part of the appearance section/minimap or anything) )

thats a future problem :), can add variant etc when it will be needed
btw all storage functions have ability to work on multiple keys

youtube/menu/satus.js

Lines 957 to 967 in 04a604b

satus.storage.set = function(key, value, callback) {
var items = {},
target = this.data;
if (typeof key !== 'string') {
return;
}
key = key.split('/').filter(function(value) {
return value != '';
});

but its never used and implemented in a weird way.
Even the only place where this could be used

youtube/menu/functions.js

Lines 135 to 137 in 87aa7e4

for (var key in data) {
satus.storage.set(key, data[key]);
}

doesnt use this ability.
Im not a fan of function overloading, especially when its not documented. Imo it should either be

  • removed because its not used at all
  • moved to separate removeMany setMany getMany

Also, what is the deal with this?

youtube/menu/satus.js

Lines 884 to 885 in 04a604b

if (typeof target === 'function') {
return target();

is it used anywhere? what would be the usage scenario?

@raszpl raszpl deleted the patch-3 branch April 9, 2024 20:17
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.

None yet

2 participants