Module: index

Methods

(inner) init(appReducer, optionsopt) → {Store}

Initialize a Nux application.

Used to initialize a new Nux application. Any reducer that is provided will be combined with Nux's built in reducers. The initial UI is the base template for the application and is what will be rendered immediately upon initialization. A number of options can be provided as documented, and any element can be specified into which Nux will render the application, allowing for the running of multiple, disparate instances of Nux on a given page. A Redux store is returned, although direct interaction with the store should be unnecessary. Once initialized, any changes to the global state for a given Nux instance will be immediately reflected in via an efficient patching mechanism via virtual-dom.
Parameters:
Name Type Attributes Description
appReducer function The provided reducer function.
options Object <optional>
Options to configure the nux application.
Properties
Name Type Attributes Default Description
initialUI Object <optional>
{ui: {}} The initial UI vDOM object which will become the first state to be rendered.
localStorage Boolean <optional>
false Enable caching of global state to localStorage.
logActions Boolean <optional>
false Enable advanced logging of all actions fired.
targetElem Element <optional>
HTMLBodyElement The element into which the nux application will be rendered.
actionCreators Object <optional>
{} Custom action creators with thunks enabled
Author:
Source:
Returns:
Redux store where app state is maintained.
Type
Store

Type Definitions

Store

A Redux store.
Type:
  • Object
Properties:
Name Type Description
dispatch function Dispatch a provided action with type to invoke a matching reducer.
getState function Get the current global state.
subscribe function Provide callback to be invoked every time an action is fired.
replaceReducer function Replace an existing reducer with a new one.
Source: