Echo JS 0.11.0

<~>

MaxArt comments

MaxArt 716 days ago. link 1 point
A note to add: Array.from supports a secondary mapping function argument. Which means that instead of

Array.from(set).map(c => c.toUpperCase());

you can do

Array.from(set, c => c.toUpperCase());
MaxArt 726 days ago. link 2 points
Nice idea, but it really needs to take something else into account, and not just the memory load.
MaxArt 728 days ago. link 1 point
Yeah, I don't get why not mentioning this new method in 2023.
MaxArt 735 days ago. link 3 points
Nice attempt, but there are a couple of things that you'd like to adjust.

1. The documentation is lacking - this is expected of the project is new, just don't forget to complete it.
2. The 'culture' attribute is nice, but don't invent yet another date/time format string convention: you should adopt an existing and well known one (I suggest ICU https://unicode-org.github.io/icu/userguide/format_parse/datetime/#date-field-symbol-table) or just wrap the options for Intl.DateTimeFormat.
3. The only way to change the format is via attributes - even though you reflect them to properties, they're declared as private (in TypeScript) and the element doesn't react if you change them at runtime, which is a missed opportunity for DX.
4. Using setInterval to update the output isn't really reliable, as it may skip a second if the UI is lagging. Moreover, you don't cancel the previously set interval if you update the date/time format, and start a new one.
5. There's no need to define a private field if you're attaching a shadow root in open mode: there's already the public really property .shadowRoot (https://developer.mozilla.org/en-US/docs/Web/API/Element/shadowRoot).
6. Don't create the same template element in the constructor (and if you do that there's no need to clone its content, as it's a throwaway element). Instead, since it's static, create the template once in the module and outside the element class, and then clone its content in the constructor.
7. I suggest using a "namespace" for your custom elements of you want them to be adopted: date-time is too generic and may cause name conflicts. Try something like arx-date-time or whatever you may like.
[more]