Runs the main operating system event loop, dispatching events to registered handlers.
⚠️ NOTE: Not allowed to be called from within an async function or Promise.
This is because TSTL's polyfill of Promises makes use of coroutines, and the internal os.pullEvent() call of this function won't work.
Throws
When an error occurs in the event loop
Example
try { runOsEventLoop(false, true); // Run with debug logging } catch (error) { console.error('Event loop crashed:', error); }
runOsEventLoop(raw?:boolean,debug?:boolean):never
Parameters
raw: boolean = false
If true, uses os.pullEventRaw instead of os.pullEvent
Runs the main operating system event loop, dispatching events to registered handlers.
⚠️ NOTE: Not allowed to be called from within an async function or Promise. This is because TSTL's polyfill of Promises makes use of coroutines, and the internal os.pullEvent() call of this function won't work.
Throws
When an error occurs in the event loop
Example