Calendars.js loads the modules for every single calendar type (japan, hebrew, islamic, arabic, roc, etc.). This is bad because it downloads lots of unnecessary code to the browser, slowing down page load/render time.
PS: The switch() statement in calendars.js is also a red flag; in OO programming that's typically done by having various subclasses (one for each case in the switch statement), and calling the method directly on the subclass.
Could you enhance load.js to just load the appropriate Calendar module(s)?
Calendars.js loads the modules for every single calendar type (japan, hebrew, islamic, arabic, roc, etc.). This is bad because it downloads lots of unnecessary code to the browser, slowing down page load/render time.
Can you change the API so it only loads the calendar it needs? Or is this something you are stuck with to match the spec's API? Just in https://github.com/AhmedMustafa/ecma402/commit/d0d69a3533e23df21ba19690077a0a7697329832 I see 10 pages of unneeded code being downloaded.
PS: The
switch()
statement in calendars.js is also a red flag; in OO programming that's typically done by having various subclasses (one for eachcase
in theswitch
statement), and calling the method directly on the subclass.Could you enhance load.js to just load the appropriate Calendar module(s)?