Emit a close event
This commit is contained in:
parent
9aa6b83f86
commit
6cdfb43e4e
5 changed files with 21 additions and 11 deletions
|
@ -126,6 +126,10 @@ void Notification::OnShown() {
|
|||
Emit("show");
|
||||
}
|
||||
|
||||
void Notification::OnClosed() {
|
||||
Emit("close");
|
||||
}
|
||||
|
||||
void Notification::NotifyPropsUpdated() {}
|
||||
|
||||
// Showing notifications
|
||||
|
|
|
@ -35,6 +35,7 @@ class Notification : public mate::TrackableObject<Notification>,
|
|||
void OnClicked() override;
|
||||
void OnReplied(std::string reply) override;
|
||||
void OnShown() override;
|
||||
void OnClosed() override;
|
||||
|
||||
protected:
|
||||
Notification(v8::Isolate* isolate,
|
||||
|
|
|
@ -23,7 +23,9 @@ void AtomNotificationDelegateAdapter::NotificationClick() {
|
|||
void AtomNotificationDelegateAdapter::NotificationReplied(std::string reply) {
|
||||
observer_->OnReplied(reply);
|
||||
}
|
||||
void AtomNotificationDelegateAdapter::NotificationDestroyed() {}
|
||||
void AtomNotificationDelegateAdapter::NotificationDestroyed() {
|
||||
observer_->OnClosed();
|
||||
}
|
||||
void AtomNotificationDelegateAdapter::NotificationFailed() {}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -14,6 +14,7 @@ class NotifictionObserver {
|
|||
virtual void OnClicked() {}
|
||||
virtual void OnReplied(std::string reply) {}
|
||||
virtual void OnShown() {}
|
||||
virtual void OnClosed() {}
|
||||
|
||||
protected:
|
||||
virtual ~NotifictionObserver() {}
|
||||
|
|
|
@ -37,16 +37,7 @@ Objects created with `new Notification` emit the following events:
|
|||
**Note:** Some events are only available on specific operating systems and are
|
||||
labeled as such.
|
||||
|
||||
#### Event: 'click'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
|
||||
Emitted when the document changed its title, calling `event.preventDefault()`
|
||||
will prevent the native window's title from changing.
|
||||
|
||||
#### Event: 'close'
|
||||
#### Event: 'show'
|
||||
|
||||
Returns:
|
||||
|
||||
|
@ -64,6 +55,17 @@ Returns:
|
|||
|
||||
Emitted when the notification is clicked by the user.
|
||||
|
||||
#### Event: 'close'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
|
||||
Emitted when the notification is closed by manual intervention from the user.
|
||||
|
||||
This event is not guarunteed to be emitted in all cases where the notification
|
||||
is closed.
|
||||
|
||||
#### Event: 'reply' _macOS_
|
||||
|
||||
Returns:
|
||||
|
|
Loading…
Reference in a new issue