-
Notifications
You must be signed in to change notification settings - Fork 420
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
feat(popup-menu): fire opened
/closed
events
#718
Conversation
lib/features/popup-menu/PopupMenu.js
Outdated
@@ -176,6 +176,8 @@ PopupMenu.prototype.open = function(element, providerId, position, options) { | |||
this._bindAutoClose(); | |||
|
|||
this._render(); | |||
|
|||
this._emit('opened'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emit when actually opened (i.e. mounted by react component)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
b6612ae
to
698def6
Compare
d356d52
to
ae8af55
Compare
lib/features/popup-menu/PopupMenu.js
Outdated
@@ -122,6 +122,7 @@ PopupMenu.prototype._render = function() { | |||
entries=${ entriesArray } | |||
headerEntries=${ headerEntriesArray } | |||
scale=${ scale } | |||
emitEvent=${ this._emit.bind(this) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please expose standard onOpen
and onClose
handlers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why we emit closed throught the PREACT component? We should be fine with emitting it directly from the popup menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case it should be fine. But I was trying to keep the same approach for handling of both events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever you decide to go for, let's adhere to a common components convention: Props that are passed into a component and are callbacks are called on{NAME}
. If you go the generic emit any event route, call the thing onEvent
or onLifeCycleEvent
.
I'd advocate for a specific handler though. It makes the code easier to maintain, long term.
ae8af55
to
7e9cada
Compare
Related to camunda/camunda-modeler#3342