# Timer

### Timer Class

The Timer class is a static class that manages timer events for a script.

### Syntax

public static class **Timer**

### Member Details

#### Cancel Method

> Cancels a repeating timer.
>
> #### Syntax
>
> \[System.Obsolete("Named timers are deprecated. Use the IEventSubscription returned from Timer.Create to cancel a timer.", false)]\
> public static [void](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void) **Cancel** ([string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) name)
>
> **Parameters**
>
> > *name*
> >
> > Name of the timer to cancel.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a one time event.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDurationSeconds*
> >
> > The minimum duration to elapse before the event is generated in seconds.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a one time event.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDuration*
> >
> > The minimum duration to elapse before the event is generated.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a one time event.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDurationSeconds*
> >
> > The minimum duration to elapse before the event is generated in seconds.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
> >
> > *persistent*
> >
> > Set to true to continue generating events, false to stop after the first one
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a repeating event with an initial duration and a repeat duration.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDurationSeconds*
> >
> > The minimum duration to elapse before the event is generated in seconds.
> >
> > *repeatDurationSeconds*
> >
> > After the initial duration, events will be generated at this interval in seconds.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a one time event.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDuration*
> >
> > The minimum duration to elapse before the event is generated.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
> >
> > *persistent*
> >
> > Set to true to continue generating events, false to stop after the first one
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a repeating event with an initial duration and a repeat duration.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDuration*
> >
> > The minimum duration to elapse before the event is generated.
> >
> > *repeatDuration*
> >
> > After the initial duration, events will be generated at this interval.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a repeating event with an initial duration and a repeat duration. The event will continue as long as the script is active or until [Timer.Cancel(string)](https://help.sansar.com/hc/en-us/articles/115003551888#M:Sansar.Script.Timer.Cancel\(System.String\)) is called.
>
> #### Syntax
>
> \[System.Obsolete("Named timers are deprecated. Use the IEventSubscription returned from Timer.Create to cancel a timer.", false)]\
> public static [void](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void) **Create** ([TimeSpan](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.TimeSpan) initialDuration, [TimeSpan](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.TimeSpan) repeatDuration, [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) handler, [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) name)
>
> **Parameters**
>
> > *initialDuration*
> >
> > The minimum duration to elapse before the event is generated.
> >
> > *repeatDuration*
> >
> > After the initial duration, events will be generated at this interval.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
> >
> > *name*
> >
> > A short string to identify this Timer.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***
