Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide default implementation of showNotification for Electron #165

Merged
merged 1 commit into from
Jun 11, 2018

Conversation

bingenito
Copy link
Member

Implementation simply delegates to Electron. This still requires a polyfill to be provided (example in app.js) for Windows 7

…simply delegates to Electron. This still requires a polyfill to be provided (example in app.js) for Windows 7
@codecov
Copy link

codecov bot commented Jun 11, 2018

Codecov Report

Merging #165 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #165      +/-   ##
==========================================
+ Coverage   93.66%   93.69%   +0.02%     
==========================================
  Files          15       15              
  Lines        1294     1300       +6     
  Branches      215      218       +3     
==========================================
+ Hits         1212     1218       +6     
  Misses         82       82
Impacted Files Coverage Δ
src/Electron/electron.ts 97.32% <100%> (+0.04%) ⬆️

throw new TypeError("showNotification requires an implementation.");
const Notification = this.electron.Notification;
const notify = new Notification(Object.assign(options || {}, { title: title }));
if (options["onClick"]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if both onClick and notification are set, won't this result in two subscriptions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I felt that if you went out of your way to work that out then you want both subscribed. Note that the notification object is provided on the default w3c polyfill that redirects to showNotification which is in place for windows 7. With windows 10 the polyfill should be turned off and I'll be working on surfacing this better in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, on a similar topic, won't having show and once called cause an issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'show' event can be fired multiple times so I only wanted it attached once.

https://electronjs.org/docs/api/notification#event-show

@bingenito bingenito merged commit 38b0d6a into morganstanley:master Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants