[Bug 22720] New: Components should use "lifetime events" rather than "lifetime callbacks"

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22720

            Bug ID: 22720
           Summary: Components should use "lifetime events" rather than
                    "lifetime callbacks"
    Classification: Unclassified
           Product: WebAppsWG
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Component Model
          Assignee: dglazkov@chromium.org
          Reporter: jan@jankuca.com
        QA Contact: public-webapps-bugzilla@w3.org
            Blocks: 14949

The proposed lifecycle callbacks are awkward when one compares them to other JS
components which dispatch native events.

The usual approach to callbacks is that the component instance is an
`EventTarget` and events are dispatched as `target.dispatchEvent(e)`. As an
alternative, there can be event handler callback functions assigned to the
`EventTarget` instance. For example, if there is the `READY` event, the
`Element` (being an `EventTarget`) fires 'ready' events that can be listened
for via listener callback functions added as `element.addEventListener(type,
listener)` or via event handlers added as `element.onready = handler`

It does not make any sense (at least to me) to introduce a new way of doing
callbacks when there are two ways implemented throughout the whole DOM (and
other places).

The proposed callbacks should be converted to events as:
- readyCallback -> READY, 'ready', onready (or should it be rather CREATE?)
- insertedCallback -> INSERT, 'insert', oninsert
- removedCallback -> REMOVE, 'remove', onremove

This also allows for a seamless integration with existing libraries such as
jQuery, Google Closure Library and others.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 18 July 2013 02:45:56 UTC