MessageLoop
Post events to main GUI message loop.
Module | require("gui") |
Type | Object |
Depending on the runtime you use, Yue may or may not provide this API.
Note that MessageLoop
is a class instead of an instance, the APIs are
provided as class methods. This is because the MessageLoop
does not manage
message loop, it just provides wrappers of system GUI message loop APIs.
This class can not be created by user, you can only call its class methods.
const gui = require('gui')
gui.MessageLoop.run()
Class methods
run()
Enter GUI message loop.
quit()
Quit current message loop.
postTask(task)
Post a task
to main thread's message loop.
Parameters
Function
task
postDelayedTask(ms, task)
Post a task
to main thread's message loop and execute it after ms
.
Parameters
Integer
ms - The number of milliseconds to waitFunction
task
setTimer(ms, task)
Enqueue a task task
to be run multiple times on the main thread's
message loop, delaying every ms
miliseconds, and stopping if the task
returns false
.
Parameters
Integer
ms - The number of milliseconds to waitFunction
task