defclass static methods and fields
It would be great if defclass could support static methods and fields as it's widely available now.
At the moment as a workaround I am doing the following as mentioned here (https://clojureverse.org/t/modern-js-with-cljs-class-and-template-literals/7450/6):
(defclass DisplayVar
(extends HTMLElement)
(constructor [this]
(super))
Object
(attributeChangedCallback [this name old-val new-val]
(js/console.log name old-val new-val)))
(set! (.-observedAttributes DisplayVar) ["variable"])
Agreed
Is there any prior art of this in shadow-cljs? the defclass syntax stuff in squint is mostly borrowed ffrom shadow.
No, as he mentioned in that linked Clojureverse thread there weren't standards about it at the time. There is also issues in the Closure compiler for static and private class extensions. So this is probably the reason he never extended the functionality
This is actually one of the big reasons I am using squint. Using shadow with the Google Closure Compiler has issues with a lot of modern libraries that are starting to use these features and it doesn't look like they will be resolved soon.
Perhaps just:
Object
(^:static foobar []
(js/fetch "https://clojure.org"))
would be ok-ish?
Perhaps just:
Object (^:static foobar [] (js/fetch "https://clojure.org"))would be ok-ish?
Yeah I think that would be ok