SlideShare uma empresa Scribd logo
1 de 35
YUI for your hacks Subramanyan Murali Web Developer, Hacker, Photographer Yahoo! Content Engineering
“The browser is an inefficient and inconsistent  application platform” - Douglas Crockford
It is an dynamic environment with a lot of inconsistencies and challenges forus engineers  to think harder   3
… hence we end up spending more time fixing the mess, rather than developing something cool   4
So we decided to dust the mess under the covers and give you  5
YUI is all about doing more with less  6
YUI 2.x gave you over 30 components to play with 7
YUI 2.x gave the developer the ability to quickly build up great web interactions …   8
But YUI 2.x was fun for Open hack day 2009 9
Step aside YAHOO,  here comes YUI 10
YUI.use(‘lighter’, function(Y) {  Y.all(‘.fasterli’).each( function(li) {   li.set(‘innerHTML’, ‘easier’);       });  }); 11
YUI 3 was built to be lighter, faster and easier to work with 12
YUI 3 is Lighter  Load only the stuff you need  YUI 3 automatically determines the dependencies and loads it on your page  Code is optimized  Learnt from mistakes in YUI 2  Better version support  13
YUI 3 is Faster  Code was re-factored for better performance  Ability to sandbox your code 14
YUI 3 is Easier  Consistent API Support for chaining  Selectors support to easily traverse the DOM tree Ability to use YUI 2 and YUI 3 together Dependencies are self populating  15
<script src=“yui-min.js”> <script>  <script type=‘text/javascript’> YUI().use(“anim”, function(Y)  { varx = new Y.Anim({             node    : “#some”,                             easing : Y.Easing.bounceOut          }); x.run()      });  </script>  16
Node is the core for YUI 3 DOM manipulation Normalized event handling 17
18 // Native Events Y.one(‘.cona’).on(‘click’, handler); // Custom Events slider.on(‘valueChange’, handler);
YUI 3 has better support for ‘interesting moments’ on the page 19
//Create a YUI instance YUI().use(‘event-custom’, function(Y)  {      function publisher() { Y.fire(‘my-app:started’);     }    ….    function subscriber()  { Y.on(‘my-app:started’, function(e) { e.preventDefault();         }; Y.after(‘my-app:started’, function(e) {             ….         };       } });   20
Node can be batched as NodeList, operations can be batched on NodeListas well 21
22 // Node List Y.all(‘.conli’).addClass(‘some’); // Helper Functions on Node List Y.all(‘.conli’).each(function(item, i){ item.set(‘innerHTML’, ‘wow ’+i); });
Fetching data has never been easier, same domain or X-domain  23
// Create a YUI instance using io-base module. YUI().use(‘io-base’, function(Y) {  varuri = “get.php?foo=bar”;        function complete(id, o, args) {  var id      = id,                           // Transaction ID                data = o.responseText, // Response data args = args[1];                 // ‘a’     };       // Subscribe to event io:complete Y.on(‘io:complete’, complete, Y, [‘a’, ‘b’]);       // Make an HTTP request to get.php var request = Y.io(uri);  });  24
// Create a YUI instance using io-xdr module. YUI().use(‘io-xdr’, function(Y) { varxdrCfg = { src : ‘io.swf’	}; Y.io.transport( xdrCfg ); varcfg = { xdr         : { use : ‘flash’ }, 	  data       : ‘foo=bar&baz=boo’, 	  timeout : 3000,  	}; Y.on( ‘io:success’, function( id, o, args ) { var data = o.responseText;  // handle data },this); 	// Start the transaction var request = Y.io( uri, cfg); }); 25
We handle the browser mess, you concentrate on your Hack 26
YUI 3 is Open source and you can contribute … http://yuilibrary.com/projects/yui3/  27
You can even use YUI 2 modules within a YUI 3 sandbox …  28
YUI().use(‘dd-drag’, ‘yui2-calendar’,  function(Y) {  //Will run YUI 2 code unmodified  var YAHOO    = Y.YUI2;    varCalender = YAHOO.widget.Calender; var cal = new Calendar(‘calCont’);  cal.renderEvent.subscribe(function() { vardd = new Y.DD.Drag({               node: ‘#calCont’           }).addHandle(‘div.calheader’);        }); cal.render();        }); 29
Or use the cool things that others have already created … http://yuilibrary.com/gallery/ 30
YUI().use(‘node’,                     ‘gallery-storage-lite’,                     ‘yui2-editor’,  function(Y) {    var YAHOO = Y.YUI2; var STORE = Y.StorageLite;               …..        } );  31
YUI has a lot of documentation, examples and is backed by a strong community http://developer.yahoo.com/yui/3/ http://developer.yahoo.com/yui/3/examples/ http://yuilibrary.com/gallery/ http://yuiblog.com/ 32
Start with an Idea Search the Data  Solve the problem  Present it with YUI  33
“An idea can transform the world and rewrite all the rules ”    ,[object Object],Happy Hacking !!! 34
Contact  Photos  http://flickr.com/photos/rmsguhan Blog  http://rmsguhan.com Twitter  @rmsguhan 35

Mais conteúdo relacionado

Mais procurados

Get started with YUI
Get started with YUIGet started with YUI
Get started with YUI
Adam Lu
 
Jquery introduce
Jquery introduceJquery introduce
Jquery introduce
Major Ye
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j query
Md. Ziaul Haq
 
Awesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom LibrariesAwesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom Libraries
FITC
 

Mais procurados (20)

Get started with YUI
Get started with YUIGet started with YUI
Get started with YUI
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
 
Leveraging jQuery's Special Events API (JSConf 2012)
Leveraging jQuery's Special Events API (JSConf 2012)Leveraging jQuery's Special Events API (JSConf 2012)
Leveraging jQuery's Special Events API (JSConf 2012)
 
Hack with YUI
Hack with YUIHack with YUI
Hack with YUI
 
Special Events
Special EventsSpecial Events
Special Events
 
Jquery introduce
Jquery introduceJquery introduce
Jquery introduce
 
Glade & PYGTK
Glade & PYGTKGlade & PYGTK
Glade & PYGTK
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j query
 
Utility libraries to make your life easier
Utility libraries to make your life easierUtility libraries to make your life easier
Utility libraries to make your life easier
 
Matters of State
Matters of StateMatters of State
Matters of State
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery Applications
 
Functionality Focused Code Organization
Functionality Focused Code OrganizationFunctionality Focused Code Organization
Functionality Focused Code Organization
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGL
 
YUI3 - IIT Madras HackU
YUI3 - IIT Madras HackU YUI3 - IIT Madras HackU
YUI3 - IIT Madras HackU
 
Awesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom LibrariesAwesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom Libraries
 
Js Project - Architecture
Js Project - ArchitectureJs Project - Architecture
Js Project - Architecture
 
DOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryDOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQuery
 
Javascript session june 2013 (iii) jquery json
Javascript session june 2013 (iii) jquery   jsonJavascript session june 2013 (iii) jquery   json
Javascript session june 2013 (iii) jquery json
 
20120121
2012012120120121
20120121
 

Destaque

Do it Best POS - Microsoft RMS
Do it Best POS - Microsoft RMSDo it Best POS - Microsoft RMS
Do it Best POS - Microsoft RMS
System Solutions
 
Location aware Web Applications
Location aware Web ApplicationsLocation aware Web Applications
Location aware Web Applications
Subramanyan Murali
 

Destaque (20)

PSC 2011.1 - Apresentação Geral
PSC 2011.1 - Apresentação GeralPSC 2011.1 - Apresentação Geral
PSC 2011.1 - Apresentação Geral
 
Tabela da Série A 2012 - Campeonato Brasileiro
Tabela da Série A 2012 - Campeonato BrasileiroTabela da Série A 2012 - Campeonato Brasileiro
Tabela da Série A 2012 - Campeonato Brasileiro
 
Do it Best POS - Microsoft RMS
Do it Best POS - Microsoft RMSDo it Best POS - Microsoft RMS
Do it Best POS - Microsoft RMS
 
Candidatos São Paulo
Candidatos São PauloCandidatos São Paulo
Candidatos São Paulo
 
Power Production Fuels & Jamaica
Power Production Fuels & JamaicaPower Production Fuels & Jamaica
Power Production Fuels & Jamaica
 
Bs Vs I P
Bs Vs I PBs Vs I P
Bs Vs I P
 
What to Blog about @ Academic Libraries
What to Blog about @ Academic LibrariesWhat to Blog about @ Academic Libraries
What to Blog about @ Academic Libraries
 
A simple model of the liver microcirculation
A simple model of the liver microcirculationA simple model of the liver microcirculation
A simple model of the liver microcirculation
 
Clipboard support on Y! mail
Clipboard support on Y! mailClipboard support on Y! mail
Clipboard support on Y! mail
 
Yahoo! Frontend Building Blocks
Yahoo! Frontend Building BlocksYahoo! Frontend Building Blocks
Yahoo! Frontend Building Blocks
 
Professional Css
Professional CssProfessional Css
Professional Css
 
Is it good to be paranoid ?
Is it good to be paranoid ?Is it good to be paranoid ?
Is it good to be paranoid ?
 
What the Hack??
What the Hack??What the Hack??
What the Hack??
 
Get me my data !
Get me my data !Get me my data !
Get me my data !
 
Study of Aerodynamics of a Cricket Ball
Study of Aerodynamics of a Cricket BallStudy of Aerodynamics of a Cricket Ball
Study of Aerodynamics of a Cricket Ball
 
Yahoo! Geo Technologies-IITD
Yahoo! Geo Technologies-IITDYahoo! Geo Technologies-IITD
Yahoo! Geo Technologies-IITD
 
Asynchronous Javascript and Rich Internet Aplications
Asynchronous Javascript and Rich Internet AplicationsAsynchronous Javascript and Rich Internet Aplications
Asynchronous Javascript and Rich Internet Aplications
 
When Why What of WWW
When Why What of WWWWhen Why What of WWW
When Why What of WWW
 
Location aware Web Applications
Location aware Web ApplicationsLocation aware Web Applications
Location aware Web Applications
 
A2 A Ppt
A2 A PptA2 A Ppt
A2 A Ppt
 

Semelhante a YUI for your Hacks

夜宴52期《从函数构造到YUI沙箱》
夜宴52期《从函数构造到YUI沙箱》夜宴52期《从函数构造到YUI沙箱》
夜宴52期《从函数构造到YUI沙箱》
Koubei Banquet
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yet
Tom Croucher
 
YUI for control freaks - a presentation at The Ajax Experience
YUI for control freaks - a presentation at The Ajax ExperienceYUI for control freaks - a presentation at The Ajax Experience
YUI for control freaks - a presentation at The Ajax Experience
Christian Heilmann
 
Y hack-china-2013
Y hack-china-2013Y hack-china-2013
Y hack-china-2013
Syu-jhih Wu
 
Yui3在美团 2
Yui3在美团 2Yui3在美团 2
Yui3在美团 2
Kai Cui
 
YUI introduction to build hack interfaces
YUI introduction to build hack interfacesYUI introduction to build hack interfaces
YUI introduction to build hack interfaces
Christian Heilmann
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
JavaScript APIs - The Web is the Platform - MDN Hack Day, MontevideoJavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
JavaScript APIs - The Web is the Platform - MozCamp, Buenos AiresJavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, ChileJavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
Robert Nyman
 

Semelhante a YUI for your Hacks (20)

Hack U - YUI - 2012 IIT Kharagpur
Hack U - YUI - 2012 IIT KharagpurHack U - YUI - 2012 IIT Kharagpur
Hack U - YUI - 2012 IIT Kharagpur
 
夜宴52期《从函数构造到YUI沙箱》
夜宴52期《从函数构造到YUI沙箱》夜宴52期《从函数构造到YUI沙箱》
夜宴52期《从函数构造到YUI沙箱》
 
Hack with YUI
Hack with YUIHack with YUI
Hack with YUI
 
Yui intro
Yui introYui intro
Yui intro
 
YUI 3
YUI 3YUI 3
YUI 3
 
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yetServer Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yet
 
YUI for control freaks - a presentation at The Ajax Experience
YUI for control freaks - a presentation at The Ajax ExperienceYUI for control freaks - a presentation at The Ajax Experience
YUI for control freaks - a presentation at The Ajax Experience
 
YUI3 and AlloyUI Introduction for Pernambuco.JS 2012
YUI3 and AlloyUI Introduction for Pernambuco.JS 2012YUI3 and AlloyUI Introduction for Pernambuco.JS 2012
YUI3 and AlloyUI Introduction for Pernambuco.JS 2012
 
Y hack-china-2013
Y hack-china-2013Y hack-china-2013
Y hack-china-2013
 
YUI on the go
YUI on the goYUI on the go
YUI on the go
 
Yui3在美团 2
Yui3在美团 2Yui3在美团 2
Yui3在美团 2
 
YUI introduction to build hack interfaces
YUI introduction to build hack interfacesYUI introduction to build hack interfaces
YUI introduction to build hack interfaces
 
Prototype UI
Prototype UIPrototype UI
Prototype UI
 
YUI (Advanced)
YUI (Advanced)YUI (Advanced)
YUI (Advanced)
 
YUI for your Hacks-IITB
YUI for your Hacks-IITBYUI for your Hacks-IITB
YUI for your Hacks-IITB
 
Embracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend PerfEmbracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend Perf
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
JavaScript APIs - The Web is the Platform - MDN Hack Day, MontevideoJavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
 
2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui
 
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
JavaScript APIs - The Web is the Platform - MozCamp, Buenos AiresJavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, ChileJavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
 

Mais de Subramanyan Murali

Mais de Subramanyan Murali (7)

Yahoo Mail moving to React
Yahoo Mail moving to ReactYahoo Mail moving to React
Yahoo Mail moving to React
 
Web as a data resource
Web as a data resourceWeb as a data resource
Web as a data resource
 
Welcome to University Hack Day @ IIT Chennai
Welcome to University Hack Day @ IIT Chennai Welcome to University Hack Day @ IIT Chennai
Welcome to University Hack Day @ IIT Chennai
 
YUI open for all !
YUI open for all !YUI open for all !
YUI open for all !
 
Fixing the developer Mindset
Fixing the developer MindsetFixing the developer Mindset
Fixing the developer Mindset
 
Basics of Rich Internet Applications
Basics of Rich Internet ApplicationsBasics of Rich Internet Applications
Basics of Rich Internet Applications
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

YUI for your Hacks

  • 1. YUI for your hacks Subramanyan Murali Web Developer, Hacker, Photographer Yahoo! Content Engineering
  • 2. “The browser is an inefficient and inconsistent application platform” - Douglas Crockford
  • 3. It is an dynamic environment with a lot of inconsistencies and challenges forus engineers to think harder  3
  • 4. … hence we end up spending more time fixing the mess, rather than developing something cool  4
  • 5. So we decided to dust the mess under the covers and give you 5
  • 6. YUI is all about doing more with less 6
  • 7. YUI 2.x gave you over 30 components to play with 7
  • 8. YUI 2.x gave the developer the ability to quickly build up great web interactions … 8
  • 9. But YUI 2.x was fun for Open hack day 2009 9
  • 10. Step aside YAHOO, here comes YUI 10
  • 11. YUI.use(‘lighter’, function(Y) { Y.all(‘.fasterli’).each( function(li) { li.set(‘innerHTML’, ‘easier’); }); }); 11
  • 12. YUI 3 was built to be lighter, faster and easier to work with 12
  • 13. YUI 3 is Lighter Load only the stuff you need YUI 3 automatically determines the dependencies and loads it on your page Code is optimized Learnt from mistakes in YUI 2 Better version support 13
  • 14. YUI 3 is Faster Code was re-factored for better performance Ability to sandbox your code 14
  • 15. YUI 3 is Easier Consistent API Support for chaining Selectors support to easily traverse the DOM tree Ability to use YUI 2 and YUI 3 together Dependencies are self populating 15
  • 16. <script src=“yui-min.js”> <script> <script type=‘text/javascript’> YUI().use(“anim”, function(Y) { varx = new Y.Anim({ node : “#some”, easing : Y.Easing.bounceOut }); x.run() }); </script> 16
  • 17. Node is the core for YUI 3 DOM manipulation Normalized event handling 17
  • 18. 18 // Native Events Y.one(‘.cona’).on(‘click’, handler); // Custom Events slider.on(‘valueChange’, handler);
  • 19. YUI 3 has better support for ‘interesting moments’ on the page 19
  • 20. //Create a YUI instance YUI().use(‘event-custom’, function(Y) { function publisher() { Y.fire(‘my-app:started’); } …. function subscriber() { Y.on(‘my-app:started’, function(e) { e.preventDefault(); }; Y.after(‘my-app:started’, function(e) { …. }; } });   20
  • 21. Node can be batched as NodeList, operations can be batched on NodeListas well 21
  • 22. 22 // Node List Y.all(‘.conli’).addClass(‘some’); // Helper Functions on Node List Y.all(‘.conli’).each(function(item, i){ item.set(‘innerHTML’, ‘wow ’+i); });
  • 23. Fetching data has never been easier, same domain or X-domain 23
  • 24. // Create a YUI instance using io-base module. YUI().use(‘io-base’, function(Y) { varuri = “get.php?foo=bar”;   function complete(id, o, args) { var id = id, // Transaction ID data = o.responseText, // Response data args = args[1]; // ‘a’ };   // Subscribe to event io:complete Y.on(‘io:complete’, complete, Y, [‘a’, ‘b’]);   // Make an HTTP request to get.php var request = Y.io(uri); }); 24
  • 25. // Create a YUI instance using io-xdr module. YUI().use(‘io-xdr’, function(Y) { varxdrCfg = { src : ‘io.swf’ }; Y.io.transport( xdrCfg ); varcfg = { xdr : { use : ‘flash’ }, data : ‘foo=bar&baz=boo’, timeout : 3000, }; Y.on( ‘io:success’, function( id, o, args ) { var data = o.responseText; // handle data },this); // Start the transaction var request = Y.io( uri, cfg); }); 25
  • 26. We handle the browser mess, you concentrate on your Hack 26
  • 27. YUI 3 is Open source and you can contribute … http://yuilibrary.com/projects/yui3/ 27
  • 28. You can even use YUI 2 modules within a YUI 3 sandbox … 28
  • 29. YUI().use(‘dd-drag’, ‘yui2-calendar’, function(Y) { //Will run YUI 2 code unmodified var YAHOO = Y.YUI2;   varCalender = YAHOO.widget.Calender; var cal = new Calendar(‘calCont’); cal.renderEvent.subscribe(function() { vardd = new Y.DD.Drag({ node: ‘#calCont’ }).addHandle(‘div.calheader’); }); cal.render(); }); 29
  • 30. Or use the cool things that others have already created … http://yuilibrary.com/gallery/ 30
  • 31. YUI().use(‘node’, ‘gallery-storage-lite’, ‘yui2-editor’, function(Y) {   var YAHOO = Y.YUI2; var STORE = Y.StorageLite; ….. } ); 31
  • 32. YUI has a lot of documentation, examples and is backed by a strong community http://developer.yahoo.com/yui/3/ http://developer.yahoo.com/yui/3/examples/ http://yuilibrary.com/gallery/ http://yuiblog.com/ 32
  • 33. Start with an Idea Search the Data Solve the problem Present it with YUI  33
  • 34.
  • 35. Contact Photos http://flickr.com/photos/rmsguhan Blog http://rmsguhan.com Twitter @rmsguhan 35