Top Banner
A Deep Dive into Enyo Ben Combee Developer Platform Architect, Enyo Team, HP [email protected] @unwiredben on Twitter Thursday, May 31, 12
63

A Deeper Look at the Enyo JavaScript Framework Presentation 1

Nov 26, 2015

Download

Documents

John Kelly

enyo framework javascript
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: A Deeper Look at the Enyo JavaScript Framework Presentation 1

A Deep Dive into EnyoBen Combee

Developer Platform Architect, Enyo Team, [email protected]@unwiredben on Twitter

Thursday, May 31, 12

Page 2: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Thursday, May 31, 12

Page 3: A Deeper Look at the Enyo JavaScript Framework Presentation 1

We need 500 apps for the TouchPad, stat!

Thursday, May 31, 12

Page 4: A Deeper Look at the Enyo JavaScript Framework Presentation 1

We want apps from devs that aren’tHTML+CSS experts.

Thursday, May 31, 12

Page 5: A Deeper Look at the Enyo JavaScript Framework Presentation 1

How?

Thursday, May 31, 12

Page 6: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Components.As seen in Visual Basic.They’re not sexy.They work.

Thursday, May 31, 12

Page 7: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Cross-platform:Desktop browsers.Mobile browsers.Apps.

Thursday, May 31, 12

Page 8: A Deeper Look at the Enyo JavaScript Framework Presentation 1

All source is on github.com/enyojsApache 2.0 forever.

Thursday, May 31, 12

Page 9: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Enyo 2.0: The Core Parts

Thursday, May 31, 12

Page 10: A Deeper Look at the Enyo JavaScript Framework Presentation 1

boot - load all the source

Thursday, May 31, 12

Page 11: A Deeper Look at the Enyo JavaScript Framework Presentation 1

/* package.js */

enyo.depends( “app.js”, “../css/app.css”, “$lib/onyx”);

Thursday, May 31, 12

Page 12: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Thursday, May 31, 12

Page 13: A Deeper Look at the Enyo JavaScript Framework Presentation 1

kernel - OOP, there it is

Thursday, May 31, 12

Page 14: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.kind() is a constructor factory

Thursday, May 31, 12

Page 15: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.kind({ name: “FireFly”, kind: “TelevisionShow”, show: function() { this.inherited(arguments); system.play(“ObjectsInSpace.mp4”); }});var ff = new FireFly();// wait 10 weeksdelete ff;

Thursday, May 31, 12

Page 16: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.Object provides property publishing

Thursday, May 31, 12

Page 17: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.kind({ name: “UPC”, kind: enyo.Object, published: { productID: “0000000000” }, create: function() { this. productIDChanged(); }, productIDChanged: function(oldValue) { this.barcode = generate(this.productID); }});

Thursday, May 31, 12

Page 18: A Deeper Look at the Enyo JavaScript Framework Presentation 1

var x = new UPC({ productID: “123456789X”});

x.setProductID(“5678900002”);pID = x.getProductID();

Thursday, May 31, 12

Page 19: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.Component enables encapsulation and events

Thursday, May 31, 12

Page 20: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.kind({ name: “SithLord”, kind: “Jedi”, events: { onSpeak: “” }, scream: function(message) { doSpeak({ message: message, tone: “whiney” }); })});

Thursday, May 31, 12

Page 21: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.kind({ name: “SithLords”, components: [ { kind: SithLord, name: “DarthVader”, onSpeak: “listenToToys” }, { kind: SithLord, name: “Palpatine” }, { kind: SithLord, name: “DarthSidious” } ], listenToToys: function(inSender, inEvent) { alert(inEvent.mesage); }});

Thursday, May 31, 12

Page 22: A Deeper Look at the Enyo JavaScript Framework Presentation 1

var toys = new SithLords;

toys.$.DarthVader.setWeapon(lightsaber);toys.$.DarthVader.throw(toys.$.Palpatine);toys.$.DarthVader.scream(“NOOOOOOO!”);

Thursday, May 31, 12

Page 23: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.UIComponent provides hooks for layout control

Thursday, May 31, 12

Page 24: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.Signals is routing for app-level events

Thursday, May 31, 12

Page 25: A Deeper Look at the Enyo JavaScript Framework Presentation 1

lang.js - utilitieslog.js - loggingjob.js - setTimeout wrapperanimation.js - math + reqFramemacroize.js - templatesPhoneGap.js - app event supportplatform.js - platform-detection code

Thursday, May 31, 12

Page 26: A Deeper Look at the Enyo JavaScript Framework Presentation 1

dom - dealing with HTML

Thursday, May 31, 12

Page 27: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.Control:a rendering engine for HTML

Thursday, May 31, 12

Page 28: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.kind({ name: “BumperSticker”, kind: enyo.Control, tag: “div”, content: “I’m Fluent in JS!”, style: “color: blue; font-size: 96pt”});

var bs = new BumperSticker();bs.renderInto(document.body);

Thursday, May 31, 12

Page 29: A Deeper Look at the Enyo JavaScript Framework Presentation 1

dispatcher.js:hooks all the standard DOM events into the Enyo event system

Thursday, May 31, 12

Page 30: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.kind({ name: “BumperSticker”, content: “I’m Fluent in JS!”, style: “color: blue; font-size: 96pt”, tap: function() { alert(“someone bumped me!”); }});

var bs = new BumperSticker();bs.renderInto(document.body);

Thursday, May 31, 12

Page 31: A Deeper Look at the Enyo JavaScript Framework Presentation 1

ajax - data-access through XHR & JSONP

Thursday, May 31, 12

Page 32: A Deeper Look at the Enyo JavaScript Framework Presentation 1

function apiOK(inAsync, inValue) { alert( “success: “ + inValue ); }function apiFAIL(inAsync, inError) { alert( “FAIL: “ + inError ); }

var a = new enyo.Ajax({ url: “http://example.org/api” });a.response(apiOK);a.error(apiFAIL);a.go({ q: searchString });

Thursday, May 31, 12

Page 33: A Deeper Look at the Enyo JavaScript Framework Presentation 1

ui - building blocks for making themed widgets

Thursday, May 31, 12

Page 34: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Button.jsCheckbox.jsImage.jsInput.jsRepeater.jsRichText.jsSelect.js

BaseLayout.jsDragAvatar.jsGroup.jsGroupItem.jsSelection.jsToolDecorator.js

Thursday, May 31, 12

Page 35: A Deeper Look at the Enyo JavaScript Framework Presentation 1

touch - enyo.Scroller & touchscreen support

Thursday, May 31, 12

Page 36: A Deeper Look at the Enyo JavaScript Framework Presentation 1

enyo.Scroller handles showing10 lbs of content in a 2 lb box

with tweaks to scroll smoothly on modern browsers and touch screens

Thursday, May 31, 12

Page 37: A Deeper Look at the Enyo JavaScript Framework Presentation 1

The Layout Libraries

Thursday, May 31, 12

Page 38: A Deeper Look at the Enyo JavaScript Framework Presentation 1

fittable - responsive app layouts

Thursday, May 31, 12

Page 39: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Thursday, May 31, 12

Page 40: A Deeper Look at the Enyo JavaScript Framework Presentation 1

list - optimized scrolling through 1000s of items

Thursday, May 31, 12

Page 41: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Thursday, May 31, 12

Page 42: A Deeper Look at the Enyo JavaScript Framework Presentation 1

panels - configurable app layouts

Thursday, May 31, 12

Page 43: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Thursday, May 31, 12

Page 44: A Deeper Look at the Enyo JavaScript Framework Presentation 1

tree - collapsable display of structure information

Thursday, May 31, 12

Page 45: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Thursday, May 31, 12

Page 46: A Deeper Look at the Enyo JavaScript Framework Presentation 1

...and now, let’s introduce Onyx

Thursday, May 31, 12

Page 47: A Deeper Look at the Enyo JavaScript Framework Presentation 1

if enyo is jQuery(i.e. very useful by itself)

Thursday, May 31, 12

Page 48: A Deeper Look at the Enyo JavaScript Framework Presentation 1

then Onyx is our jQuery UI(a library that extends the core to do great things)

Thursday, May 31, 12

Page 49: A Deeper Look at the Enyo JavaScript Framework Presentation 1

CSS themes +JS behavior +composite controls

Thursday, May 31, 12

Page 50: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Thursday, May 31, 12

Page 51: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Button, Checkbox, Drawer, FlyweightPicker, Grabber, Groupbox, Icon, Input, Menu, Toolbar, Picker, Popup, ProgressBar, ProgressButton, RadioButton, RichText, Scrim, Slider, Spinner, SwipeableItem, TabPanels, TextArea, Tooltip

Phew!

Thursday, May 31, 12

Page 52: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Samples

Thursday, May 31, 12

Page 53: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Onyx Sampler - live views of all Onyx controls & sample code

enyojs.com/samples/onyxsampler

Thursday, May 31, 12

Page 54: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Flickr Search - find pictures from search terms

enyojs.com/samples/flickr

Thursday, May 31, 12

Page 55: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Bing Maps - wraps external JS library with Enyo control

enyojs.com/samples/maps

Thursday, May 31, 12

Page 56: A Deeper Look at the Enyo JavaScript Framework Presentation 1

API Viewer - pulls inline docs from source tree

enyojs.com/api

Thursday, May 31, 12

Page 57: A Deeper Look at the Enyo JavaScript Framework Presentation 1

CryptoTweets -game using enyo & onyx & web services

enyojs.com/samples/cryptotweets

Thursday, May 31, 12

Page 58: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Community Gallery - listing of developer-contributed controls

enyojs.com/gallery

Thursday, May 31, 12

Page 59: A Deeper Look at the Enyo JavaScript Framework Presentation 1

The Enyo Community

Thursday, May 31, 12

Page 60: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Developer Forums - forums.enyojs.comBlog - blog.enyojs.comTwitter - @enyojsEmail - [email protected]

Thursday, May 31, 12

Page 61: A Deeper Look at the Enyo JavaScript Framework Presentation 1

github - github.com/enyojs

fork, modify, send us pretty pull requestssubmit components to the community galleryparticipate on the forums

Thursday, May 31, 12

Page 62: A Deeper Look at the Enyo JavaScript Framework Presentation 1

We’re hiring great JavaScript engineers.Know about cross-platform mobile web?Worked on your own frameworks?

Talk to us!email [email protected]

Thursday, May 31, 12

Page 63: A Deeper Look at the Enyo JavaScript Framework Presentation 1

Thursday, May 31, 12