Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/devices/pebble/modules/global/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
8 changes: 8 additions & 0 deletions build/devices/pebble/modules/global/pebble-global.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}