Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTimerMBS class.

NSTimerMBS.Constructor(fireDate as date, timeInterval as Double, repeats as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 10.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initializes a new NSTimer.
Example
dim d as new date
d.hour = d.hour + 1 // start in one hour

dim n as new NSTimerMBS(d, 5, true)

fireDate: The time at which the timer should first fire.

timeInterval: For a repeating timer, this parameter contains the number of seconds between firings of the timer. If seconds is less than or equal to 0.0, this method chooses the nonnegative value of 0.1 milliseconds instead.
repeats: If true, the timer will repeatedly reschedule itself until invalidated. If false, the timer will be invalidated after it fires.

The time is initialized such that, when added to a run loop, it will fire at date and then, if repeats is true, every seconds after that.

See also:

NSTimerMBS.Constructor(fireDate as date, timeInterval as Double, repeats as boolean, runloop as NSRunLoopMBS, runloopMode as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 13.5 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initializes a new NSTimer.

fireDate: The time at which the timer should first fire.

timeInterval: For a repeating timer, this parameter contains the number of seconds between firings of the timer. If seconds is less than or equal to 0.0, this method chooses the nonnegative value of 0.1 milliseconds instead.
repeats: If true, the timer will repeatedly reschedule itself until invalidated. If false, the timer will be invalidated after it fires.

The time is initialized such that, when added to a run loop, it will fire at date and then, if repeats is true, every seconds after that.

Schedules the timer to run on the given runloop in the given mode.

See also:

NSTimerMBS.Constructor(fireDate as dateTime, timeInterval as double, repeats as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 20.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates and returns a new NSTimer object and schedules it on the current run loop in the default mode.

timeInterval: The number of seconds between firings of the timer. If seconds is less than or equal to 0.0, this method chooses the nonnegative value of 0.1 milliseconds instead.
repeats: If true, the timer will repeatedly reschedule itself until invalidated. If false, the timer will be invalidated after it fires.

After seconds seconds have elapsed, the timer fires, calling the Action event.

See also:

NSTimerMBS.Constructor(fireDate as dateTime, timeInterval as double, repeats as boolean, runloop as NSRunLoopMBS, runloopMode as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 20.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes a new NSTimer.

fireDate: The time at which the timer should first fire.

timeInterval: For a repeating timer, this parameter contains the number of seconds between firings of the timer. If seconds is less than or equal to 0.0, this method chooses the nonnegative value of 0.1 milliseconds instead.
repeats: If true, the timer will repeatedly reschedule itself until invalidated. If false, the timer will be invalidated after it fires.

The time is initialized such that, when added to a run loop, it will fire at date and then, if repeats is true, every seconds after that.

Schedules the timer to run on the given runloop in the given mode.

See also:

NSTimerMBS.Constructor(timeInterval as Double, repeats as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates and returns a new NSTimer object and schedules it on the current run loop in the default mode.
Example
dim n as new NSTimerMBS(5, true)
MsgBox str(n.timeInterval)

timeInterval: The number of seconds between firings of the timer. If seconds is less than or equal to 0.0, this method chooses the nonnegative value of 0.1 milliseconds instead.
repeats: If true, the timer will repeatedly reschedule itself until invalidated. If false, the timer will be invalidated after it fires.

After seconds seconds have elapsed, the timer fires, calling the Action event.

See also:

NSTimerMBS.fire

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Causes the receiver's message to be sent to its target.

You can use this method to fire a repeating timer without interrupting its regular firing schedule. If the timer is non-repeating, it is automatically invalidated after firing, even if its scheduled fire date has not arrived.

NSTimerMBS.invalidate

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Stops the receiver from ever firing again and requests its removal from its run loop.
Example
dim n as new NSTimerMBS(5, true)

// later

n.invalidate

The destructor calls invalide automatically for you.

This method is the only way to remove a timer from an NSRunLoop object. The NSRunLoop object removes and releases the timer, either just before the invalidate method returns or at some later point.

You must send this message from the thread on which the timer was installed. If you send this message from another thread, the input source associated with the timer may not be removed from its run loop, which could prevent the thread from exiting properly.

The items on this page are in the following plugins: MBS MacCocoa Plugin.


The biggest plugin in space...