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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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