ibm-js / ecma402

ECMA-402 JavaScript Internationalization API "shim"
Other
34 stars 21 forks source link

lots of unneeded calendar code downloaded #44

Closed wkeese closed 10 years ago

wkeese commented 10 years ago

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 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)?

wkeese commented 10 years ago

Thanks for fixing that.