# Module: heartBeat

Runs a given ping function periodically and watches for timeouts.

Version:
  - 1.0.0
Author:
  - Pedro Miguel P. S. Martins

### Methods

#### <inner> getBeatInterval()

  Returns the current hearbeat interval. The heartbeat interval is the interval at which the heartbeat will run the `ping` function.

  ##### Returns:

  The current heartbeat interval.
  Type
    Number

#### <inner> hasTimedOut()

  Used to detected if a heartbeat has timedout. A heartbeat times out when it sends a ping, and receives no pong after a given period of time. The timeout period can be manipulated via `setBeatTimeout`.
  See:
    - `setBeatTimeout`

  ##### Returns:

  `true` if the heartbeat has timedout, `false` otherwise.
  Type
    Boolean

#### <inner> setBeatInterval(newInterval)

  Sets the current heartbeat interval to the given one. Note that setting the heartbeat interval will not affetct current heartbeat running. You must `stop` them and then `start` them for the new interval to be applied.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `newInterval` | Number | The new heartbeat interval.

  See:
    - `stop`
    - `start`

#### Search results