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

Fixes #1392 - Add actionHandler to ClayManagementToolbar #1402

Closed
wants to merge 12 commits into from
Closed

Fixes #1392 - Add actionHandler to ClayManagementToolbar #1402

wants to merge 12 commits into from

Conversation

carloslancha
Copy link
Contributor

No description provided.

@@ -5,6 +5,7 @@
*/
{template .render}
{@param name: string}
{@param? _handleActionItemClicked: any}
Copy link
Contributor

Choose a reason for hiding this comment

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

SF?

@@ -42,7 +43,10 @@
{param contentRenderer: 'image' /}
{param disabled: $disabled /}
{param elementClasses: $classes /}
{param events: ['itemToggled': $_handleItemToggled ] /}
{param events: [
Copy link
Contributor

Choose a reason for hiding this comment

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

SF?

@@ -116,6 +116,11 @@ class ClayComponent extends Component {

const listeners = this.getRawListeners_(eventName);

if (this.actionHandler) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the actionHandler be able to prevent events?

@jbalsas
Copy link
Contributor

jbalsas commented Dec 18, 2018

We've had an offline conversation about this... the proposal is to move this to a defaultEventHandler for clarity, and tweak the emit method so that the lifecycle is as follows:

  • An event is emitted
  • We loop through all registered listeners
    • If they're default listeners, we store them for later
    • If they're regular listeners, we run them passing down the event facade
  • If we have a registered defaultEventHandler, with the event method implementation, we run it passing down the event facade
  • If no-one has prevented the default behaviour, we run the stored default listeners

@jbalsas jbalsas closed this Dec 18, 2018
@carloslancha
Copy link
Contributor Author

Resent #1405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants