Conversation
peternewman
left a comment
There was a problem hiding this comment.
Just some minor comments
| } | ||
| } | ||
|
|
||
| ;(async () => { |
There was a problem hiding this comment.
Is the leading semicolon some weird prettier quirk (I've seen similar before)?
| ;(async () => { | ||
| await Promise.allSettled(promises) | ||
| self.initPresets() | ||
| })() |
There was a problem hiding this comment.
I'm not hot enough on my async/promise stuff; will this function block until the promise is resolved and not allow program flow to continue, or will it do it in the background as it's async? Are we fine because the await is inside an async?
I was just thinking it would be good to initPresets beforehand too, but that's irrelevant if it runs in the background...
There was a problem hiding this comment.
Once all promises are resolved, the presets will be updated. Since this is local communication, it is assumed that all promises resolve immediately, allowing the presets to be updated in bulk.
Before retrieving icons, initPresets is executed. Once all icons have been successfully retrieved, initPresets is executed again.
| for (let i = 0; i < (this.CHOICES_APPS || []).length; i++) { | ||
| let app = this.CHOICES_APPS[i] | ||
| presets[`select_app_${i}`] = { | ||
| const preset = { |
There was a problem hiding this comment.
Ah, the mutable Javascript const!
Out of curiosity, what's the benefit of the preset over just putting the properties directly into the one we were creating before?
Co-authored-by: Peter Newman <peternewman@users.noreply.github.com>
Implemented without using external modules.
Overlaying text on icons poses a challenge: depending on the icon's color, the text may become unreadable. For now, I'll open a pull request for sharing code.