feat(sys): expose canGoBack for the chrome that offers the control
This commit is contained in:
@@ -50,6 +50,10 @@ int back(lua_State* state) {
|
||||
Runtime::from(state)->requestBack();
|
||||
return 0;
|
||||
}
|
||||
int canGoBack(lua_State* state) {
|
||||
lua_pushboolean(state, Runtime::from(state)->canGoBack());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getMemory(lua_State* state) {
|
||||
const MemoryInfo memory = Runtime::from(state)->sys().memory();
|
||||
@@ -88,16 +92,22 @@ const luaL_Reg FUNCTIONS[] = {
|
||||
// --- Changes the running app's display title.
|
||||
// @param title string
|
||||
{"setAppTitle", setAppTitle},
|
||||
// --- Launches /.lua/apps/<path>/main.lua and pushes the current route.
|
||||
// @param path string App-relative directory path; traversal is rejected.
|
||||
// @param arg string|nil Passed to init(arg).
|
||||
// --- Launches a route, which main.lua resolves, and pushes the current
|
||||
// one.
|
||||
// @param path string App-relative route; traversal is rejected.
|
||||
// @param arg string|nil Passed to main.start(route, arg).
|
||||
{"launch", launch},
|
||||
// --- Launches an app path without retaining the current route.
|
||||
// @param path string App-relative directory path; traversal is rejected.
|
||||
// @param arg string|nil Passed to init(arg).
|
||||
// --- Launches a route without retaining the current one.
|
||||
// @param path string App-relative route; traversal is rejected.
|
||||
// @param arg string|nil Passed to main.start(route, arg).
|
||||
{"replace", replace},
|
||||
// --- Returns to the previous app, or the launcher when history is empty.
|
||||
{"back", back},
|
||||
// --- Whether sys.back() would return somewhere rather than land on the
|
||||
// launcher, which is what chrome needs to decide whether to offer a back
|
||||
// control.
|
||||
// @return boolean
|
||||
{"canGoBack", canGoBack},
|
||||
// --- Returns heap statistics.
|
||||
// @return integer freeBytes
|
||||
// @return integer totalBytes
|
||||
|
||||
Reference in New Issue
Block a user