Search code examples
enyo

Object, Component and Control Specification


May anyone explain what exactly is an Object, a Component and a Control. Also, how does each of them differs from each other? What i know is that a control is a component which interacts directly with DOM node.


Solution

  • All Enyo entities are Objects; it's the root of the Enyo object Tree. Component is the base for most of the 'interesting' kinds within Enyo and derives from Object. Component introduces the idea of the nested hierarchy in Enyo, published properties and events. See more here: https://github.com/enyojs/enyo/wiki/Creating-Components. Controls are Components that have a DOM node associated with them, as you said. You can see more here: https://github.com/enyojs/enyo/wiki/Creating-Controls.

    As you move up the tree within Enyo child objects inherit from their parents. So, Control has all the methods, properties, etc. that Component has, as well as the ones Component inherited from Object.

    You might also want to check out my book: Enyo: Up and Running