Getting started with YUI3 and AlloyUI

Post on 10-May-2015

3.492 views 8 download

Tags:

description

Jax Conf @ Mainz, Germany @ April, 2013

Transcript of Getting started with YUI3 and AlloyUI

getting startedwith YUI3 and

AlloyUI

Mainz, 2013.

how someback-end

devs seethemselves

how someback-end

devs seefront-end

devs

“CSS is very easy”

“javascriptis ugly andfull of bugs”

EcmaScript 6 is coming

front-endis changing

there are three types of people

1. those who compile javascript

2. those who doesn’t compile

3. java == javascript

today we’regoing totalk aboutserver-agnosticJS frameworks

Events,Selection,DOM Manipulation,Animation,Ajax requests

jquery.com

YUI3modules

YUI =

effects

DOM

ajax

events...

MVC

YUI =

effects

DOM

ajax

events...

MVC

YUI =

effects

DOM

ajax

events...

MVC

YUI =

effects

DOM

ajax

events...

MVC

YUI =

effects

DOM

ajax

events...

MVC

YUI =

effects

DOM

ajax

events...

MVC

YUI =

effects

DOM

ajax

events...

MVC

YUI3basics

$('.foo');

DOM traversalY.all('.foo');

YUI3

jQuery

$('#foo').html('bar');

DOMmanipulationY.one('#foo').setHTML('bar');

YUI3

jQuery

$('#close-btn').on('click', function() { // do something});

eventsY.one('#close-btn').on('click', function() { // do something});

YUI3

jQuery

$('#fade').animate({ opacity: 0,}, 5000);

effectsY.one('#fade').transition({ duration: 1, opacity : 0});

YUI3

jQuery

$.ajax({ url: "api.json", success: function(data) { // do something }});

ajaxY.io('api.json', { on: { success: function(data) { // do something } }});

YUI3

jQuery

YUI3loading

“Optimize the front-end performance first, because 80/90% of the user response time is spent there.”

- Steve Souders,Engineer at Google

without YUI...

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/jquery-ui.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/mustache.js/0.7.2/mustache.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.5/require.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.2/ember-1.0.pre.js"></script>......

performance--maintainability--

blocks render

with YUI...

one <script>

everything elseasynchronous combo-loaded

from CDN

sandboxYUI().use('module-name', function (Y) { // code goes here});

why asynchronous?

non-blockinghttp requests

whycombo-loaded?

whyload from a CDN?

geographicallycloser

YUIgallery

your code onYahoo’s CDN

available to anyone

just use()YUI().use('gallery-audio', function (Y) { // code goes here});

AlloyUI

created on 2009

built on top of YUI3

AlloyUI =

calendar

tabs

buttons

carousel...

audio

AlloyUI =

calendar

tabs

buttons

carousel...

audio

AlloyUI =

calendar

tabs

buttons

carousel...

audio

AlloyUI =

calendar

tabs

buttons

carousel...

audio

AlloyUI =

calendar

tabs

buttons

carousel...

audio

AlloyUI =

calendar

tabs

buttons

carousel...

audio

AlloyUI =

calendar

tabs

buttons

carousel...

audio

what we wanted:char counter

#twitter-box

#myTextarea

#myCounter

#twitter-box

#myTextarea

#myCounter

#twitter-box

#myTextarea

#myCounter

#twitter-box

#myTextarea

#myCounter

what we wanted:schedule

what we wanted:a better way toexpress ideas

* drag and drop UI* flexible API* support all browsers* no flash (HTML5)

but I’ma javaguy!

<taglibs> \o/

taglibs<aui:button name="saveButton" type="submit" value="save"/>

Button

taglibs<aui:input name="myField" > <aui:validator name="required" /> <aui:validator name="digits" /> <aui:validator name="range" > [8,50] </aui:validator></aui:input>

Form Validation

the success of an application doesn’t depends on the technology itself...

...but how it is applied.

dank :)