O'Reilly logo

Enyo: Up and Running by Roy Sutton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Core Concepts

Introduction

In this chapter, we’ll cover the core concepts of Enyo that we only touched on in the last chapter. You will be able to write powerful apps after absorbing the information in just this chapter. We’ll go over the concepts one by one and illustrate each with code you can run in your browser.

One of the driving ideas behind Enyo is that combining simple pieces creates complex apps. Enyo introduces four concepts to assist you: kinds, encapsulation, components, and layout. We’ll cover components and layout more thoroughly in Chapter 3 and Chapter 4, respectively.

Kinds

Enyo is an object-oriented framework. It is true that every JavaScript application regardless of framework (or lack thereof) contains objects. However, Enyo’s core features provide a layer on top of JavaScript that makes it easier to express object-oriented concepts such as inheritance and encapsulation.

In Enyo, kinds are the building blocks that make up apps. The widgets that appear on screen are instances of kinds, as are the objects that perform Ajax requests. Kinds are not strictly for making visual components. Basically, kinds provide a template from which the actual objects that make up your app are generated.

Be Kind

One of the simplest possible declarations for a kind is:

enyo.kind({ name: "MyKind" });

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required