Skip to main content
Hominid Software — Talks by Doug Reeder

Enyo: Yet Another Framework or The Next Step Beyond Dojo?

talk delivered at CAS, the Chemical Abstracts Service of the American Chemical Society

Outline #

Who's it from?

Why A New Framework?

What is Enyo Not?

Enyo Constructors are simple to write

enyo.kind({
name: "Foo"
})
var f = new Foo();

Subclassing is easy, and doesn't require a new directory.

enyo.kind({
name: "Bar",
kind: "Foo",
newProperty: 42
});

Observation: rendering engines are fast at turning big block of HTML to a DOM, slow to update DOM

Objects interact in 3 ways

Message Passing requires

Component: Enyo Kind that participates in lifecycle & message-passing

Control: Enyo kind associated w/ 1 or more DOM Elements (like a Dijit), and so participates in layout

Ownership/Containment example:

Owners call ordinary methods on their children. Familiar, flexible.

DOM events bubble as usual

Custom Events sent to owners. No addListener machinery -> must check that strings match

PubSub -> Enyo:

Example: Date picker DatePicker graphic

a Control with one DOM Element:

{tag: "hr"}

or

{className: "sidebar"}

a Control with multiple DOM Elements:

{content: "<ol><li>alpha</li><li>beta</li></ol>"}

a Control with many DOM nodes:

{kind: "HtmlContent", srcId: "myContent", onLinkClick: "htmlContentLinkClick"}

index.html:

<div id="myContent">a lot of HTML...which ends here</div>

a Control from a framework widget:

{kind: "Button", caption: "OK", onclick: "okClick"}

a Control from your agglomeration of widgets:

{kind: "MyControlPanel"}

It's turtles all the way down! (Everything is a Control.)

Why JavaScript alone and no HTML?

panel of Controls same as standard widget -> start with standard widget, replace with custom.
example: ?

Layout: encourages but does not require CSS3 Flex Boxes (not emulated for IE8/9)

Ajax API same as Control API.
Any async API (e.g. WebSQL) same as Control API.
A list shouldn't care whether it's receiving info from a button press, WebSQL callback, or AJAX callback.

Combining With Other Frameworks

Message-Passing
Dojo: Pub-Sub or ?. MUX. Separate objects for separate channels. Stovepiped.
Enyo: Owner. MUX, transform. One object may support multiple channels

[show example code]

Status as of early February 2012:


Module Pattern
Facade Pattern
Mediator Pattern