Lifetime

Event loop and application lifetime.

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

This class initializes a GUI event loop, and provides APIs to manage application's lifetime. Depending on the runtime you use, Yue may or may not provide this API.

If you are using Yue in an environment that does not have its own event loop, you should create Lifetime at any time before entering event loop.

nu::State state;
nu::Lifetime lifetime;
lifetime.Run();

Methods

void Run()

Enter event loop.

void Quit()

Quit event loop.

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

Post a task to event loop.

Parameters

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

Post a task to event loop and execute it after ms.

Parameters

Events

void on_ready() macOS

Emitted when received applicationDidFinishLaunching notification.

Preventable

No.