Skip to content

Dynamic Application Modules

Jason Best edited this page Oct 24, 2016 · 6 revisions

Starting in version 3.5 the application module supports dynamic loading. This means when mobile loads initially and you see the login page, your customization would NOT be loaded. When the application finishes sequences to initialize state (AppStatePromises), initModulesDynamic is fired by the Application instance, this will invoke the initDynamic function on every registered ApplicationModule. The ApplicationModule base class now has four new methods:

  • initDynamic - Entry point, invoked by the Application instance. Most customizers should not worry about this method.
  • loadCustomizationsDynamic - Same as loadCustomizations, except the App.context and other state initialized will be available.
  • loadToolbarsDynamic - Same as loadToolbars, except the App.context and other state initialized will be available.
  • loadViewsDynamic - Same as loadViews, except the App.context and other state initialized will be available.

Why

There are certain customizations you might want to load conditionally, and might not know until runtime or the user has logged in. One common case is integrations. If you fetch all of the available integrations in your app state, you can use that to dynamically load additional views required for that integration. Since this will be so common, we added it to argos-saleslogix as part of the App.context.integrations object. The BOE integration uses this to determine if it should load:

  isIntegrationEnabled: function isIntegrationEnabled() {
    const results = this.application.context.integrations.filter(integration => integration.Name === 'Back Office Extension')[0];
    return results && results.Enabled;
  },

Clone this wiki locally