views:

108

answers:

1

Overview:

In my project, all of the UI Components that are rendered in DOM/HTML, are stored/managed as Javascript objects of type Component.

Each Component Object contains a ComponentListener class which listens for events coming from the DOM/HTML rendering, and also listens for events fired to the Component that it might receive from the EventController.

The EventController is just another Javascript class that implements a centralized Publisher/Subscriber Pattern (or if you prefer, a centralized Subject/Observer Pattern)...to promote decoupling.

The ComponentListener is given the definition below:

Definition:

An object that receives events for its parent component-object, from managed elements in the DOM (that are managed by the parent component-object), or from the EventController.

For Example:

An instance of ComponentListener that might have its onMouseEnter method that will be called when the mouse enters the <div> element that represents the component-object that it is listening to events for.

Question:

Does my definition of the ComponentListener warrent being defined as another term rather than Listener? Or am I about "spot on" defining it as ComponentListener?

A: 

Listeners listens to events, not components. Components generate events. If you search for event listeners I am sure you will find interesting material.

Hemal Pandya
Okay so listeners listen to events...the events I'm talking about come from the DOM elements, a.k.a. the HTML representation of the UI component which is managed by a JS object which contains a ComponentListener.
leeand00
I am not sure what the question is. "An object that receives events" is a listener, it usually gets the component that raised the event as parameter. That is a good definition. "a component-object from the DOM or from the EventController" seems to be your specific example.
Hemal Pandya
I just edited my question again for clarification...I don't think I was clear enough last time.
leeand00