# Class: HistoryController

## HistoryController

#### new HistoryController(defaultTitle)

  Manage history pushState and popstate event

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `defaultTitle` | string | Default page title

  ##### Example

      let h = new HistoryController( 'The default page title' )

      // Push a new state in the history
      h.pushState( {data: 1}, 'The page title', '/path/page.html' )

      // Return the current page state
      h.getState()

      // Update the anchor of the current url
      h.updateAnchor( anchor )

      // Register an handler for popState
      h.register( handler ) => ( url, state )

      // remove a registered handler for popState
      h.remove( handler )

### Members

#### state :state_Object

  Get the current page state

  ##### Type:

  - state_Object

### Methods

#### pushState(state, title, url)

  Push a new state in the history

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `state` | Object | Native browser state object
  `title` | String |
  `url` | String |

  ##### Returns:

  Type
    HistoryController

#### register(handler)

  Register an handler for popState

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | HistoryController_Callback |

  ##### Returns:

  Type
    HistoryController

#### remove(handler)

  Remove a registered handler for popState

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function |

  ##### Returns:

  Type
    HistoryController

#### updateAnchor(anchor)

  Update the anchor of the current url

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `anchor` | String |

  ##### Returns:

  Type
    HistoryController

### Type Definitions

#### HistoryController_Callback(url, state)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `url` | String |
  `state` | oOject | Native browser state object

#### state_Object

  ##### Type:

  - object

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `url` | String |
  `state` | Object | Native browser state object
  `title` | String |

#### Search results