diff --git a/build/devices/pebble/modules/global/global.js b/build/devices/pebble/modules/global/global.js index 0d496ee90..7a1751d78 100644 --- a/build/devices/pebble/modules/global/global.js +++ b/build/devices/pebble/modules/global/global.js @@ -202,6 +202,7 @@ export class Pebble { get launch() {return native("xs_global_launch_get").call(this);} get wake() {return native("xs_global_wake_get").call(this);} + exit(reason) { return native("xs_global_exit").call(this, reason); } } export default Pebble; diff --git a/build/devices/pebble/modules/global/pebble-global.c b/build/devices/pebble/modules/global/pebble-global.c index 1a5baaaad..6bac5267e 100644 --- a/build/devices/pebble/modules/global/pebble-global.c +++ b/build/devices/pebble/modules/global/pebble-global.c @@ -27,6 +27,7 @@ #include "applib/app_light.h" #include "applib/app_watch_info.h" #include "applib/connection_service.h" +#include "applib/ui/app_window_stack.h" #include "process_state/app_state/app_state.h" static void connectionChanged(bool connected) @@ -224,3 +225,10 @@ void xs_global_light(xsMachine *the) else app_light_enable(xsmcTest(xsArg(0))); } + +void xs_global_exit(xsMachine *the) +{ + if (xsmcArgc >= 1 && xsmcTest(xsArg(0))) + app_exit_reason_set(xsmcToInteger(xsArg(0))); + app_window_stack_pop_all(true); +}