Skip to content

rendering events #365

@luxzeitlos

Description

@luxzeitlos

This is meant to be an alternative to modifiers (#353). Also this is a bit a vague idea I just had, and I would love some feedback. If some people like it I will try my best and try to write an RFC for this.

Basically why don't we just introduce rendering events like normal DOM events?

<button DidInsertElement={{action 'didInsertButton'}} WillDestroyElement={{action 'willDestroyButton'}}>Save</button>

This would be very straightforward to teach to everyone who understands closure actions!
The didInsertButton and willDestroyButton actions would receive a synthesized event property as single argument with a target property pointing to the DOM node.

For this example I've used uppercase event names to distinguish from normal events:

<button onclick={{action 'save'}} DidInsertElement={{action 'didInsertButton'}} WillDestroyElement={{action 'willDestroyButton'}}>Save</button>

However maybe we should use the @ sign, because in some ways its simmilar to the difference between arguments and attributes:

<button onclick={{action 'save'}} @didInsertElement={{action 'didInsertButton'}} @willDestroyElement={{action 'willDestroyButton'}}>Save</button>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions