-
Notifications
You must be signed in to change notification settings - Fork 746
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
Replace util.js polyfills with JS natives... #11871
Conversation
Replace js/misc/util.js polyfills (findIndex(), find(), each(), filter() & map()) with JS natives in cinnamon. +grouped-window-list applet: Always add alert style to thumbnail when app window needs attention and implement same style removal when app is focused (not previously implemented) +grouped-window-list applet: used 'const' instead of 'let' where possible.
Applet fails to launch: [grouped-window-list@cinnamon.org]: find is not a function |
@brownsr Thanks. Yes, I changed state.js and then forgot to add it to the commit 🤦♂️. I'll add it in a new PR |
@mtwebster Unrelated to this PR but I was wondering: in GWL applet.js are the following comments: line 205
line 262
line 845
Do you know of any reason why circular references should be avoided or perhaps this isn't necessary now? Edit: btw, there seems to be an easy way to avoid circular references by passing a function that returns an object rather than passing the object itself: i.e. instead of:
use:
|
Seeing as the gwl applet is really the only place we worry about any of this (in Cinnamon proper, at least), I doubt this is as much of an issue as was being made here. Some googling also gives me the impression JS garbage collection is robust enough to handle it np. We end up with circular refs all over the place now using _delegate in popup menus, xlets, etc... so even if it is an issue with GC it doesn't seem like a major one. We could always clear _delegates when we're cleaning up these things - that seems like it'd be easier than tying our hands ahead of time. That second snippet just seems like it'd be confusing. |
Replace all instances of
js/misc/util.js
polyfills (findIndex(), find(), each(), filter() & map()
) with JS natives in cinnamon and delete these polyfills fromutil.js
.These were originally added for performance but are now slower in current cjs. They are no longer used by any xlets in linuxmint/cinnamon-spices-applets, linuxmint/cinnamon-spices-desklets, or linuxmint/cinnamon-spices-extensions. However, they are still used in the cinnamon menu applet so this PR depends on #11865 also being merged.
+grouped-window-list applet: Always add alert style to thumbnail when app window needs attention and implement same style removal when app is focused (not previously implemented)
+grouped-window-list applet: used
const
instead oflet
where possible.