Functions

getContextTypes(classConstructor)Object.<string, function(...*): boolean>

Retrieves the context type declarations for the specified component.

setContextTypes(classConstructor, contextTypes)Object.<string, function(...*): boolean>

Overrides the previously associated context type declarations for the specified component to the provided ones.

getUtils(props, context)Object.<string, *>

Retrieves the view utilities from the component's current context or properties (preferring the context).

localize(component, key, [params])string

Returns the localized phrase identified by the specified key. The placeholders in the localization phrase will be replaced by the provided values.

link(component, name, [params])string

Generates an absolute URL using the provided route name (see the app/config/routes.js file). The provided parameters will replace the placeholders in the route pattern, while the extraneous parameters will be appended to the generated URL's query string.

cssClasses(component, classRules, includeComponentClassName)string

Generate a string of CSS classes from the properties of the passed-in object that resolve to true.

defaultCssClasses(classRules, component)string

Generate a string of CSS classes from the properties of the passed-in object that resolve to true.

fire(component, eventName, [data])

Creates and sends a new IMA.js DOM custom event from the provided component.

listen(component, eventTarget, eventName, listener)

Registers the provided event listener for execution whenever an IMA.js DOM custom event of the specified name occurs at the specified event target.

unlisten(component, eventTarget, eventName, listener)

Deregisters the provided event listener for an IMA.js DOM custom event of the specified name at the specified event target.

getContextTypes(classConstructor) ⇒ Object.<string, function(...\*): boolean> 

Retrieves the context type declarations for the specified component.

Kind: global function
Returns: Object.<string, function(...\*): boolean> - The context type declarations associated with the specified component.

Param Type Description
classConstructor function The constructor of the react component.

setContextTypes(classConstructor, contextTypes) ⇒ Object.<string, function(...\*): boolean> 

Overrides the previously associated context type declarations for the specified component to the provided ones.

Kind: global function
Returns: Object.<string, function(...\*): boolean> - The provided context type declarations.

Param Type Description
classConstructor function The constructor of the react component.
contextTypes Object.<string, function(...\*): boolean> The new context type declarations to associate with the specified component.

getUtils(props, context) ⇒ Object.<string, \*> 

Retrieves the view utilities from the component’s current context or properties (preferring the context).

Kind: global function
Returns: Object.<string, \*> - The retrieved view utilities.
Throws:

  • Error Throw if the view utils cannot be located in the provided properties nor context.
Param Type Description
props Object.<string, \*> The component’s current properties.
context Object.<string, \*> The component’s current context.

localize(component, key, [params]) ⇒ string 

Returns the localized phrase identified by the specified key. The placeholders in the localization phrase will be replaced by the provided values.

Kind: global function
Returns: string - Localized phrase.

Param Type Description
component AbstractComponent | AbstractPureComponent The component requiring the localization.
key string Localization key.
[params] Object.<string, (number\|string)> Values for replacing the placeholders in the localization phrase.

link(component, name, [params]) ⇒ string 

Generates an absolute URL using the provided route name (see the app/config/routes.js file). The provided parameters will replace the placeholders in the route pattern, while the extraneous parameters will be appended to the generated URL’s query string.

Kind: global function
Returns: string - The generated URL.

Param Type Description
component AbstractComponent | AbstractPureComponent The component requiring the generating of the URL.
name string The route name.
[params] Object.<string, (number\|string)> Router parameters and extraneous parameters to add to the URL as a query string.

cssClasses(component, classRules, includeComponentClassName) ⇒ string 

Generate a string of CSS classes from the properties of the passed-in object that resolve to true.

Kind: global function
Returns: string - String of CSS classes that had their property resolved to true.

Param Type Description
component AbstractComponent | AbstractPureComponent The component requiring the composition of the CSS class names.
classRules string | Object.<string, boolean> CSS classes in a string separated by whitespace, or a map of CSS class names to boolean values. The CSS class name will be included in the result only if the value is true.
includeComponentClassName boolean  

Example

this.cssClasses('my-class my-class-modificator', true);

Example

this.cssClasses({
           'my-class': true,
           'my-class-modificator': this.props.modificator
       }, true);

defaultCssClasses(classRules, component) ⇒ string 

Generate a string of CSS classes from the properties of the passed-in object that resolve to true.

Kind: global function
Returns: string - String of CSS classes that had their property resolved to true.

Param Type Description
classRules string | Object.<string, boolean> CSS classes in a string separated by whitespace, or a map of CSS class names to boolean values. The CSS class name will be included in the result only if the value is true.
component AbstractComponent | AbstractPureComponent | string The component requiring the composition of the CSS class names, if it has the className property set and requires its inclusion this time.

fire(component, eventName, [data]) 

Creates and sends a new IMA.js DOM custom event from the provided component.

Kind: global function

Param Type Description
component AbstractComponent | AbstractPureComponent The component at which’s root element the event will originate.
eventName string The name of the event.
[data] \* Data to send within the event.

listen(component, eventTarget, eventName, listener) 

Registers the provided event listener for execution whenever an IMA.js DOM custom event of the specified name occurs at the specified event target.

Kind: global function

Param Type Description
component AbstractComponent | AbstractPureComponent The component requesting the registration of the event listener.
eventTarget React.Element | EventTarget The react component or event target at which the listener should listen for the event.
eventName string The name of the event for which to listen.
listener function The listener for event to register.

unlisten(component, eventTarget, eventName, listener) 

Deregisters the provided event listener for an IMA.js DOM custom event of the specified name at the specified event target.

Kind: global function

Param Type Description
component AbstractComponent | AbstractPureComponent The component that requested the registration of the event listener.
eventTarget React.Element | EventTarget The react component or event target at which the listener should listen for the event.
eventName string The name of the event for which to listen.
listener function The listener for event to register.