Area: Optimizely CMS
Applies to versions: 10 and higher
Other versions:

Adding a module initializer

Recommended reading 

This topic introduces the module initializer in Optimizely. A module initializer is a JavaScript function that is run when the related module is started. This is useful for doing any configuration or script loading that should be done before the edit user interface is made available.

Configuring the module initializer

The initializer is configured in the module.config file for your add-on. The initializer attribute on
the clientModule element determines the path to the module initializer to run. For example:

<clientModule initializer="acme/Initializer">

Module initializer

The module initializer should return an object that has an initialize function. This is the function that will be called when the module initializer is run. We recommend that you extend epi/_Module when implementing a module initializer as this implements the expected API and also provides helper methods for performing common initializer actions. So the skeleton for your module initializer will look something like this:

       function (declare, _Module) {
         return declare([_Module], {
           initialize: function () {
Do you find this information helpful? Please log in to provide feedback.

Last updated: Sep 05, 2017

Recommended reading