No worries mate. JS can be a b**ch to pick up.
What you really need is to move those module-global variables into the class definition, so they are class-instance properties.
Then change all the access from $picker to this.$picker etc.
Then Bob’s your uncle! ![]()
P.S. I could have made the changes myself and submit a PR, but I got scared of forking the entire Discourse repo just to test such small changes…