Package Exports
- @lordprotector/shutdown-block-reason
- @lordprotector/shutdown-block-reason/lib/binding.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lordprotector/shutdown-block-reason) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
shutdown-block-reason
Small Node native module to call ShutdownBlockReasonCreate
and ShutdownBlockReasonDestroy
.
In couple with recently added query-session-end
event it allows to prevent the Windows from shutting down
if Electron app is busy for whatever reason (unsaved work, actively doing something very important,
app needs an extended amount of time to shut down gracefully).
import {
create as createShutdownBlockReason,
destroy as destroyShutdownBlockReason
} from "@lordprotector/shutdown-block-reason"
(async () => {
// create a window...
createShutdownBlockReason(mainWindow.getNativeWindowHandle(), 'Electron application is closing...');
// Handle Windows WM_QUERYENDSESSION signal
mainWindow.on('query-session-end', (ev: WindowSessionEndEvent) => {
console.log('query-session-end event received', ev.reasons);
ev.preventDefault();
// save work...
destroyShutdownBlockReason(mainWindow.getNativeWindowHandle());
});
})();