diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-25 13:13:02 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-25 18:20:18 +0530 |
| commit | 4cbaaae7c55e71d2d4db591029394812077eb844 (patch) | |
| tree | 23574a00f4790332e9aafb4fd86fbc046c0ed85a /src/LuaRuntime.hpp | |
| parent | 346c16b4e2ea26f47e0e370a490b7794492a9ebb (diff) | |
| download | null-browser-4cbaaae7c55e71d2d4db591029394812077eb844.tar.gz null-browser-4cbaaae7c55e71d2d4db591029394812077eb844.zip | |
Add web.history for history navigation
Diffstat (limited to '')
| -rw-r--r-- | src/LuaRuntime.hpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/LuaRuntime.hpp b/src/LuaRuntime.hpp index 94d24d8..c90049e 100644 --- a/src/LuaRuntime.hpp +++ b/src/LuaRuntime.hpp @@ -5,6 +5,7 @@ #include <lua.hpp> #include "AsyncEventLoop.hpp" +#include "utils.hpp" #include "widgets/WebViewStack.hpp" #define preserve_top(STATE, BODY) \ @@ -32,15 +33,19 @@ public: void start_event_loop(); DELEGATE(event_loop, queue_task, queue_task) - QVariant get_lua_value(int idx); + QVariant get_lua_value(int idx, QVariant default_value = 0); DEFINE_GETTER(get_state, state) + DEFINE_FETCHER(qsizetype(), current_tab_id) + signals: void url_opened(QString url, OpenType open_type); void evaluation_completed(QVariant value); void evaluation_failed(QString value); void keymap_add_requested(QString mode, QString keyseq, std::function<void()>); + void history_back_requested(WebViewId webview_id, qsizetype history_index); + void history_forward_requested(WebViewId webview_id, qsizetype history_index); // void output_produced(QVariant value); protected: @@ -50,6 +55,9 @@ protected: static int lua_on_url_open(lua_State *state); static int lua_on_url_tab_open(lua_State *state); static int lua_add_keymap(lua_State *state); + static int lua_get_current_tab_id(lua_State *state); + static int lua_history_back(lua_State *state); + static int lua_history_forward(lua_State *state); private: lua_State *state; |
