# Luakit Documentation / Classes / timer

# Class `timer`

Timer support for Luakit

## Example usage:

    local t = timer{ interval = 500 }

    t:add_signal("timeout", function ()
        print("500msec later!")
    end)

    t:start()

## Functions

### timer (properties)

Create a new timer instance.

#### Parameters

- properties
  Type: table
  Optional
  Default: `{}`
  Any initial timer properties to set.

## Methods

### timer:start ()

Start a timer.

The timer must already have an interval set. The timer should not already be running.

### timer:stop ()

Stop a timer.

The timer should already be running.

## Properties

### timer.interval

Type: integer
Read-write
The interval of the timer, in milliseconds.

### timer.started

Type: boolean
Default: `false`
Read-only
Whether the timer is running.

## Signals

### "timeout"

This signal is emitted when the time on the timer has expired.

#### Parameters

- timer
  Type: timer
  The timer that has expired.

## Attribution

#### Copyright

- 2010 Mason Larobina