wheel.js

37
Wheel.js Why everyone should make their own JavaScript framework, now

Upload: baccigalupi

Post on 18-May-2015

2.101 views

Category:

Technology


0 download

DESCRIPTION

Does the world need another front-end JavaScript framework. Apparently it does. This is a presentation on the need for a mobile and desktop web framework, and one possible rebuilding of the wheel.

TRANSCRIPT

Page 1: Wheel.js

Wheel.js

Why everyone should make their own JavaScript framework, now

Page 2: Wheel.js

“I tend to liken JavaScript to water”

Page 3: Wheel.js

“… alone it's painfully simple but it can take

the form of its container”

Page 4: Wheel.js

- John Resigauthor of jQuery

Page 5: Wheel.js

jQuery

Page 6: Wheel.js

jQuery + Plugins

Page 7: Wheel.js

jQuery + Plugins + a little app code

Page 8: Wheel.js

Then js grew up

• Rendering• Logic

Page 9: Wheel.js

:(

Page 10: Wheel.js

Tools Proliferate

Page 11: Wheel.js

Tools Proliferate• jQuery UI• Backbone• Sammy.js• Ember.js• Spine.js• Underscore• Can.js

• JavaScriptMVC• AngularJS• Ext.js• Agility.js• KnockoutJS• Knockback.js• …

Page 12: Wheel.js

What’s the clear path?

Page 13: Wheel.js

But wait … there is more

< 2007 :)

Page 14: Wheel.js

> 2007 :(

Page 15: Wheel.js

And I want things

Dialogs

Menus

Form widgets

etc …

Page 16: Wheel.js

Wish List

• Platform for big or small js• Cross-device & Cross-browser compatibility• Install and code, sensible default app• Ability to customize what I don’t like• Library add-ons

Page 17: Wheel.js

Wheel.js

I am trying to build my wishlist.You should too!

Page 18: Wheel.js

Wheel = Object-Oriented

Page 19: Wheel.js

Instance Methods/Variables

Page 20: Wheel.js

Class Methods/Variables

Page 21: Wheel.js

Subclassing

Page 22: Wheel.js

Got _super?

Page 23: Wheel.js

Keep it dry with modules

Page 24: Wheel.js

Why is OO important?

Page 25: Wheel.js

Why is OO important?

Because customizing thismeans copy/paste

Page 26: Wheel.js

Wheel is View-centric!(and flexible)

• be attached to existing browser DOM• be built with a string• received via ajax• hand-built• generate own DOM from a template

Views can …

Page 27: Wheel.js

Gathering Views from DOMGiven HTML in the browser

Page 28: Wheel.js

Gathering Views from DOM

A simple view class for todo tasks

Page 29: Wheel.js

View Anatomy

Page 30: Wheel.js

Switching to DOM Generation

Page 31: Wheel.js

View Niceties

Superclass initialization automatically– Finds/generates DOM– Provides a handy this.$ for DOM manipulation– Calls ‘listen’ after subclass ‘init’ block is called– Sets options passed in as instance variables– Automatically appends to parent, when parent

option provided

Page 32: Wheel.js

Adding Persistence

Page 33: Wheel.js

Ajax Mixin

• ‘data’ method to specify what will be sent to the server

• ‘onComplete’, ‘onSuccess’, ‘onError’ methods• prototype/instance can set the http method• Module converts ‘put’ and ‘delete’ to ‘post’

with _method attribute• Needs a ‘url’ attribute

Page 34: Wheel.js

Ajaxing For the Mobile Era

• Request queue instead of direct requests• Queue stored in LocalStorage or polyfill• Application tracks connectivity• Sends requests and executes callbacks as

possible

Page 35: Wheel.js

More Mobile

• Touch/Gesture events• Event Unification• Drag/Drop Conventions• Dynamic application loader (bandwidth)• ??

Page 36: Wheel.js

++

Helpers• Poller• Cookie Manager• Models• Router/HistoryRails• Generators• Better deps manager??

Widgets• Tabs• Dialog• Searcher• Autocomplete• Form Stuff• Tooltips• Time ago helper

Page 37: Wheel.js

Github:https://github.com/baccigalupi/wheel.js