MessageLoop

Post events to main GUI message loop.

Header#include "nativeui/message_loop.h"
Namespacenamespace nu
Typeclass

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.

If you are using Yue in an environment that does not have its own event loop, you should use this API to enter message loop.

nu::MessageLoop::Run();

Class methods

void Run()

Enter GUI message loop.

void Quit()

Quit current message loop.

void PostTask(std::function<void()> task)

Post a task to main thread's message loop.

Parameters

void PostDelayedTask(int ms, std::function<void()> task)

Post a task to main thread's message loop and execute it after ms.

Parameters

void SetTimer(int ms, std::function<bool()> 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