Gob

Gob

Gob combines Actions, SocketPlugin, Reducer and the Components into a shared namespace.

Without Gob this package could only authenticate to a single server as all instances of SocketPlugin would be bound to the same Redux state.

With Gob this package can authenticate with multiple servers that implement the Server API with each server's Redux state separated within the store.

Important Gob.dispatcher needs to be set to the Redux store's dispatch function. This will happen automatically if you mount either Gob.React.Guest or Gob.React.Authenticated within your application. If you do not mount either of those components then you need to set dispatcher explicitly after creating your Redux store.

Constructor

new Gob(id)

Source:

Creates a new Gob.

Parameters:
Name Type Description
id string

The id common to the elements in the Gob.

Members

(readonly) Actions :Actions

Source:

Actions are the Redux actions dispatched by this Gob.

Type:

dispatcher :func

Source:

dispatcher is the dispatch function tied to the Redux store and must be set for SocketPlugin instances to communicate with the Redux store.

Mounting Gob.React.Guest or Gob.React.Authenticated in the application will set this property automatically. If not mounting either of those components then you will need to set this property explicitly after creating your Redux store.

Type:
  • func

(readonly) id :string

Source:

id is the id value the Gob was created with.

Type:
  • string

(readonly) React :Components

Source:

React returns React components for this Gob.

Type:

(readonly) Reducer :Reducer

Source:

Reducer is the Redux reducer tied to this Gob.

Type:

storage :LocalStorage

Source:

storage is the LocalStorage instance attached to this Gob.

Type:
  • LocalStorage

Methods

SocketPlugin()

Source:

SocketPlugin is a constructor to create instances of SocketPlugin tied to this Gob.

When using this constructor you do not need to pass the gob, session, or dispatch members of the SocketPlugin options.

storeToProps(state)

Source:

storeToProps is the function used as the first argument to connect() when binding a React component to Redux.

Parameters:
Name Type Description
state Object

The Redux store state.