Skip to content
Merged
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
18 changes: 15 additions & 3 deletions lib/notification-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,23 @@ function supportsDarwinNotifications() {
}

function supportsWindowsNotifications() {
// The Windows Notification APIs we use are only available on Windows 10+, and
// some of them are limited before the Creators Update (build 15063).
// See: https://docs.microsoft.com/en-us/uwp/api/windows.ui.notifications.toastnotification.tag?view=winrt-22621#remarks
const CreatorsUpdateBuildNumber = 15063

const versionComponents = os.release().split('.')
const majorVersion = parseInt(versionComponents[0], 10)

// Only Windows 10 and newer are supported
return majorVersion >= 10
const buildNumber =
versionComponents.length >= 3
? parseInt(versionComponents[2], 10)
: CreatorsUpdateBuildNumber

// Only Windows 10 (15063) and newer are supported
return (
majorVersion > 10 ||
(majorVersion === 10 && buildNumber >= CreatorsUpdateBuildNumber)
)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "desktop-notifications",
"version": "0.2.2",
"version": "0.2.3",
"description": "A simple and opinionated library for handling Windows notifications",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down