202 - Inheritance & Events

In example 201 you may have noticed that both prototypes' events were a comprhensive list of all events they subscribed to. While most developers are familiar with how arrays within objects typically inherit, it may not be the effect you wish to go for.

Let's consider that every vEwe prototype is a self contained set of behaviors. It stands to reason that each prototype should only contain "events" that pertain to that particular behavior. Defining your prototypes in this way also allows each intantiated vEwe to be a unique combination of behaviors (prototypes) that are scoped to a single DOM element (as described by the "selector").

If you wish to subscribe to the above concept you can redefine the inheritance model of your vEwes. This is done by specifying "inheritAndMergeEvents" when creating the view.

vEwe A

Ta-da!
What's under the box?

vEwe B (inherits from vEwe A)

Ta-da!
What's under the box?