In this PR, I've made the following changes to BreezeMap:
we now have classes instead of functions.
these classes have fields and methods. Some fields/methods are static, depending on the usage requirements (i.e. if we need to be able to call a method on a class without having to instantiate it, the method needs to be staticized).
by extension, everything in util.js is static because of their usage in vectorlayer.js. The fields are declared in a static block as well. Note that the fields that go inside a static block need to be declared before their assignment in the block.
the original hcmc_ol.js has been split into a constants.js, a util.js, and a vectorlayer.js.
the build currently does not have a minify option. ESBuild can probably take care of this, but that might take some doing now that the library has been split into three files.
lots of globally-scoped variables (i.e. vars) have been turned into let statements.
some return types were incorrect. Those have been fixed.
the classes need to be exported at the end of the file to be able to be imported into other files.
imports work out of the box; imports into the HTML files where these classes are used require a source type declaration of module instead of ecmascript, and the file needs to be imported explicitly in the HTML inline JavaScript bit.
In this PR, I've made the following changes to BreezeMap:
util.js
is static because of their usage invectorlayer.js
. The fields are declared in a static block as well. Note that the fields that go inside a static block need to be declared before their assignment in the block.hcmc_ol.js
has been split into aconstants.js
, autil.js
, and avectorlayer.js
.module
instead ofecmascript
, and the file needs to be imported explicitly in the HTML inline JavaScript bit.