funcunit
Version:
<!-- @hide title
28 lines (19 loc) • 703 B
Markdown
{function} System.setContextual
StealJS.functions
Create a module that is aware of its parent module.
`System.setContextual(moduleName, definer)`
{String} moduleName The name of the contextual module.
{Function|String} definer 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:
```js
System.setContextual("normalize", function(parentName){
return {
"default": function(name){
return System.normalize(name, parentName);
},
__useDefault: true
};
});
```