Implement powerMonitor 'shutdown' event for Linux.
The event is emitted when the OS is rebooting/shutting down, and allows an electron app to call `e.preventDefault()` in order to delay shutdown and exit cleanly.
This commit is contained in:
parent
28d96e2d29
commit
56b53e71aa
6 changed files with 104 additions and 2 deletions
|
@ -26,11 +26,17 @@ class PowerMonitor : public mate::TrackableObject<PowerMonitor>,
|
|||
explicit PowerMonitor(v8::Isolate* isolate);
|
||||
~PowerMonitor() override;
|
||||
|
||||
void BlockShutdown(mate::Arguments* args);
|
||||
void UnblockShutdown(mate::Arguments* args);
|
||||
|
||||
// base::PowerObserver implementations:
|
||||
void OnPowerStateChange(bool on_battery_power) override;
|
||||
void OnSuspend() override;
|
||||
void OnResume() override;
|
||||
|
||||
// atom::PowerObserver
|
||||
bool OnShutdown() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue