Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSRunLoopMBS class.

NSRunLoopMBS.AddDummyPort

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 13.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Adds a dummy port as event source.

Run loops don't loop unless there is an event source, so you can add a dummy one here.

Some examples using this method:

NSRunLoopMBS.allModes as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns array with all mode strings.

NSRunLoopMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 13.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new object using current run loop.

NSRunLoopMBS.run

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 13.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Puts the receiver into a permanent loop, during which time it processes data from all attached input sources.

If no input sources or timers are attached to the run loop, this method exits immediately; otherwise, it runs the receiver in the NSDefaultRunLoopMode by repeatedly invoking runMode:beforeDate:. In other words, this method effectively begins an infinite loop that processes data from the run loop's input sources and timers.

Manually removing all known input sources and timers from the run loop is not a guarantee that the run loop will exit. OS X can install and remove additional input sources as needed to process requests targeted at the receiver's thread. Those sources could therefore prevent the run loop from exiting.

If you want the run loop to terminate, you shouldn't use this method. Instead, use one of the other run methods and also check other arbitrary conditions of your own, in a loop.

See also:

NSRunLoopMBS.run(Seconds as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 13.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Runs the runloop for the given number of seconds.

See also:

NSRunLoopMBS.runMode(Mode as string, Seconds as Double) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 13.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Runs the runloop for the given number of seconds in the given mode.

Some examples using this method:

NSRunLoopMBS.runModeUntilDate(Mode as string, limitDate as date) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 13.5 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Runs the loop once, blocking for input in the specified mode until a given date.

mode: The mode in which to run. You may specify custom modes or use one of the modes listed in "Run Loop Modes."
limitDate: The date until which to block.

Returns true if the run loop ran and processed an input source or if the specified timeout value was reached; otherwise, false if the run loop could not be started.

If no input sources or timers are attached to the run loop, this method exits immediately and returns false; otherwise, it returns after either the first input source is processed or limitDate is reached. Manually removing all known input sources and timers from the run loop does not guarantee that the run loop will exit immediately. OS X may install and remove additional input sources as needed to process requests targeted at the receiver's thread. Those sources could therefore prevent the run loop from exiting.

Note: A timer is not considered an input source and may fire multiple times while waiting for this method to return

See also:

NSRunLoopMBS.runModeUntilDate(Mode as string, limitDate as dateTime) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 20.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Runs the loop once, blocking for input in the specified mode until a given date.

mode: The mode in which to run. You may specify custom modes or use one of the modes listed in "Run Loop Modes."
limitDate: The date until which to block.

Returns true if the run loop ran and processed an input source or if the specified timeout value was reached; otherwise, false if the run loop could not be started.

If no input sources or timers are attached to the run loop, this method exits immediately and returns false; otherwise, it returns after either the first input source is processed or limitDate is reached. Manually removing all known input sources and timers from the run loop does not guarantee that the run loop will exit immediately. OS X may install and remove additional input sources as needed to process requests targeted at the receiver's thread. Those sources could therefore prevent the run loop from exiting.

Note: A timer is not considered an input source and may fire multiple times while waiting for this method to return

See also:

NSRunLoopMBS.runOnce

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 21.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Run the runloop once.

Great to process events now in a timer in web or console projects.

Some examples using this method:

NSRunLoopMBS.runUntilDate(limitDate as date)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 13.5 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Runs the loop until the specified date, during which time it processes data from all attached input sources.

limitDate: The date up until which to run.

If no input sources or timers are attached to the run loop, this method exits immediately; otherwise, it runs the receiver in the NSDefaultRunLoopMode by repeatedly invoking runMode until the specified expiration date.

Manually removing all known input sources and timers from the run loop is not a guarantee that the run loop will exit. OS X can install and remove additional input sources as needed to process requests targeted at the receiver's thread. Those sources could therefore prevent the run loop from exiting.

See also:

NSRunLoopMBS.runUntilDate(limitDate as dateTime)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacCocoa Plugin 20.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Runs the loop until the specified date, during which time it processes data from all attached input sources.

limitDate: The date up until which to run.

If no input sources or timers are attached to the run loop, this method exits immediately; otherwise, it runs the receiver in the NSDefaultRunLoopMode by repeatedly invoking runMode until the specified expiration date.

Manually removing all known input sources and timers from the run loop is not a guarantee that the run loop will exit. OS X can install and remove additional input sources as needed to process requests targeted at the receiver's thread. Those sources could therefore prevent the run loop from exiting.

See also:

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


The biggest plugin in space...