# Class: History

## jala.History()

This class is an implementation of a Browser-like history stack suitable to use in any Helma application. The difference to a Browser's history is that this implementation ignores POST requests and checks if Urls in the stack are still valid to prevent eg. redirections to a HopObject's url that has been deleted. Plus it is capable to create new "intermediate" history-stacks and this way maintain a "history of histories" which is needed for eg. editing sessions in a popup window that should use their own request history without interfering with the history of the main window.

## Constructor

#### new History()

Constructs a new History object.

Source:
  - jala/code/History.js, line 50

### Methods

#### add()

Initializes a new history stack, adds it to the array of stacks (which makes it the default one to use for further requests) and records the current request Url.

Source:
  - jala/code/History.js, line 119

#### clear()

Clears the currently active history stack

Source:
  - jala/code/History.js, line 162

#### dump()

Returns the contents of all history stacks as string

Source:
  - jala/code/History.js, line 243

##### Returns:

The history stacks as string

#### peek(offset)

Retrieves the request Url at the given position in the current history stack. If no offset is given the last Url in the stack is returned. This method does not alter the stack contents!

##### Parameters:

Name | Type | Description
--- | --- | ---
`offset` | Number | The index position in history stack to start searching at

Source:
  - jala/code/History.js, line 232

##### Returns:

The Url of the request

#### pop(offset)

Retrieves the first valid request Url in history stack starting with a given offset. The default offset is 1. Any valid Url found is removed from the stack, therefor this method alters the contents of the history stack.

##### Parameters:

Name | Type | Description
--- | --- | ---
`offset` | Number | The index position in history stack to start searching at

Source:
  - jala/code/History.js, line 189

##### Returns:

The Url of the request

#### push()

Records a request Url in the currently active history stack.

Source:
  - jala/code/History.js, line 142

#### redirect(offset)

Redirects the client back to the first valid request in history. Please mind that searching for a valid Url starts at history.length - 2.

##### Parameters:

Name | Type | Description
--- | --- | ---
`offset` | Number | The index position in the stack to start searching at

Source:
  - jala/code/History.js, line 174

#### remove()

Removes the current history stack

Source:
  - jala/code/History.js, line 133