Premium support for our pure JavaScript UI components


Post by gbrdhvndi »

Hello there,

Both Scheduler Pro and Calendar components share a lot in common: Core, Grid, and Scheduler classes are required by both, and so the two compiled bundles (schedulerpro.lwc.module.js and calendar.lwc.module.js) include duplicate code.

Some of the core components, namely VersionHelper and Widget, expose some of their methods on the window.bryntum namespace object: getVersion, get, query, etc. However, when the two bundles are loaded together the last one to load will overwrite those exposed helper functions and bind them to its own internal instance references. This breaks the functionality for the classes from the other bundle.

For example, the ExternalEventSource class from the Calendar bundle and the UndoRedo class from the Scheduler bundle both call window.bryntum.get(). But the result of this method pretty much depends on the fact that there is only one bundle currently in use.

There are other issues as well, for example widget instance resolution with Widget.getById() only works if the Widget class was imported from the same bundle as the class which was used to create the instance in question.

I appreciate that a bundle encapsulates its content inside an iife, which makes all of the class references internal to it. And each bundle has its own copy of those, so simply exposing everything on the window.bryntum namespace won't help since the inheritance hierarchy would be broken.

But I'd like to bring this to your attention and request if there would be a possibility to ship a combined bundle in the future.

As an alternative, we could probably build our own "ultimate" bundle from source, but we'd like to avoid this as this approach has potentially high maintenance cost due to the necessity to actively maintain the list of imports and exports with each new release of your component libraries.

Thank you.

Aleksei


Post by johan.isaksson »

Hi,

For the next major (5.0) we plan to change the bundles to make it easier to combine our products on the same page. The work on that has not yet started so things may change, but it will likely be roughly like this:

Each product will have two versions of its bundle, one including only that products classes (lets call it the "slim" bundle) and one with all you need (as currently, the "all" bundle).

If you only want Scheduler on your page, you include the "all" bundle:

scheduler.all.js

To combine products, you would use the slim bundle from each product. For example for Grid & Scheduler, you would include:

core.slim.js+ grid.slim.js + scheduler.slim.js.

The grid & scheduler slim bundles would import VersionHelper, Widget etc from the core slim bundle and thus use the same modules.

I will make a public ticket to track this: https://github.com/bryntum/support/issues/2805

Best regards,
Johan Isaksson

Post by gbrdhvndi »

That is brilliant news, thank you Johan!

Am I right to presume that the styling themes will be split in a similar manner?

Aleksei


Post by johan.isaksson »

Yes that is our goal. Will start with JS bundles but hope to have CSS split also for 5.0. If not it will come later

Best regards,
Johan Isaksson

Post Reply