From 6c5f21d9f9c05d731da90a543c643029c2a01b34 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 5 Mar 2024 16:41:38 +0800 Subject: [PATCH] docs: `ya.notify()` plugin API --- docs/plugins/utils.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/plugins/utils.md b/docs/plugins/utils.md index 9c5bf437..b72944b4 100644 --- a/docs/plugins/utils.md +++ b/docs/plugins/utils.md @@ -130,6 +130,25 @@ end This function is only available in the async context. +### `notify(opts)` + +Send a foreground notification to the user: + +- `opts`: Required, the options of the notification, which is a table: + - `title`: Required, the title of the notification, which is a string. + - `content`: Required, the content of the notification, which is a string. + - `timeout`: Required, the timeout of the notification, which is an non-negative float in seconds. + - `level`: Optional, the level of the notification, which is a string accepts `"info"`, `"warn"`, and `"error"`. Default is `"info"`. + +```lua +ya.notify { + title = "Hello, World!", + content = "This is a notification from Lua!", + timeout = 6.5, + -- level = "info", +} +``` + ### `dbg(msg)` Append messages to [the log file](/docs/plugins/overview#logging) at the debug level: