steal.setContextual

  • property
{function()}  

Create a module that is aware of its parent module.

steal.setContextual(moduleName, definer)

Parameters

  1. moduleName {String}

    The name of the contextual module.

  2. definer {function() | String}

    Either a function defining the module or a moduleName to import which defines the module.

Use

Modules may want to modify their behavior based on the module that is importing them. One example would be for normalization:

steal.setContextual("normalize", function(parentName){
  return {
    "default": function(name){
      return steal.loader.normalize(name, parentName);
    },
    __useDefault: true
  };
});
Help us improve StealJS by taking our community survey