Skip to content

Add 'show' event when an object is added to a container#84

Open
pindia wants to merge 2 commits intoarturadib:masterfrom
pindia:feature-show
Open

Add 'show' event when an object is added to a container#84
pindia wants to merge 2 commits intoarturadib:masterfrom
pindia:feature-show

Conversation

@pindia
Copy link
Contributor

@pindia pindia commented Jun 27, 2012

I've added a new event "show" that is dispatched on an object is added to a container and thus added to the DOM proper. Some use cases for this are:

  • Running code only when the object is fully initialized and the model is ready
  • Not running code for prototype objects that aren't meant to be used directly

Related issues: #52

@arturadib
Copy link
Owner

Hello Pindi,

I like the idea of a show event!

I'm wondering though if there's a more robust way to make sure the element is indeed being displayed (i.e. attached to the document/DOM).

For example, in your test case, neither obj1 nor obj2 is appended to $$.document, so neither is actually "shown".

Perhaps the way to go about this is to add a hook into $$.document methods like .append() that traverses the hierarchy of sub-objects being appended/prepended/etc and then fire the corresponding show events?

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.

2 participants