SlideShare uma empresa Scribd logo
1 de 28
Baixar para ler offline
Introduction to YUI 3
Jeff Craig
May 13, 2010
Jeff Craig () Introduction to YUI 3 May 13, 2010 1 / 21
About Me
Who am I?
Software Developer at Washington State University
Contact:
foxxtrot@foxxtrot.net
http://blog.foxxtrot.net/
twitter.com/foxxtrot
github.com/foxxtrot
Jeff Craig () Introduction to YUI 3 May 13, 2010 2 / 21
YUI What
What is YUI?
Housed and Developed at Yahoo!
YUI2 Released in 2006, still actively supported
YUI3 launched late 2009
Used across most Yahoo! properties, new development is in YUI3
Designed to be scalable, fast, secure, and modular
Jeff Craig () Introduction to YUI 3 May 13, 2010 3 / 21
YUI What
YUI3 Structure
Core
Component Infrastructure
Utilities
Widgets
Developer Tools
Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
YUI What
YUI3 Structure
Core
Lang, UA, Queue, Object, Get, Array, Node, Event
Component Infrastructure
Utilities
Widgets
Developer Tools
Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
YUI What
YUI3 Structure
Core
Component Infrastructure
Base, Attribute, Plugin, Widget
Utilities
Widgets
Developer Tools
Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
YUI What
YUI3 Structure
Core
Component Infrastructure
Utilities
Animation, Cache, Cookie, DataSchema, IO, JSON, ImageLoader,
Internationalization, etc.
Widgets
Developer Tools
Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
YUI What
YUI3 Structure
Core
Component Infrastructure
Utilities
Widgets
Overlay, Slider, TabView, GridView
Developer Tools
Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
YUI What
YUI3 Structure
Core
Component Infrastructure
Utilities
Widgets
Developer Tools
Console, Profiler, Test
Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
YUI Why?
Why YUI3?
Modular: Load only the code you need.
Flexible: Base functionality provides flexible Attribute and Plugin
systems
Complete: Tons of utilities available now, and widgets are coming
Fast: Demonstrable faster at common tasks, and fast enough for one
of the worlds largest websites.
Jeff Craig () Introduction to YUI 3 May 13, 2010 5 / 21
YUI Why Not?
Why not YUI3?
Your existing codebase works
Many widgets haven’t been ported yet.
Jeff Craig () Introduction to YUI 3 May 13, 2010 6 / 21
YUI Why Not?
Why not YUI3?
Your existing codebase works
Many widgets haven’t been ported yet.
Some will not be.
Jeff Craig () Introduction to YUI 3 May 13, 2010 6 / 21
YUI SimpleYUI
SimpleYUI
Introduced with YUI 3.2
Eliminates the Sandbox
Fastest way to get started with YUI3
Provides Node/Events, Transitions, IO
Jeff Craig () Introduction to YUI 3 May 13, 2010 7 / 21
YUI SimpleYUI
Why not use SimpleYUI?
There are performance benefits to using the module pattern
There is safety in the sandbox
You have more control in standard YUI
Jeff Craig () Introduction to YUI 3 May 13, 2010 8 / 21
YUI Community
YUI3 and the Community
With YUI3, the team refocused on open-source. They launched YUI3 with
a public bug tracker and forums, and put the source up on GitHub.
In October 2009, the Gallery launched, providing a mechanism for modules
to be shared easily outside of the core of YUI, including offering hosting on
the Yahoo! CDN for modules, and easy inclusion within YUI3 projects.
In early 2010, the YUI Team began hosting ”YUI Open Hours” a periodic
conference call.
Jeff Craig () Introduction to YUI 3 May 13, 2010 9 / 21
YUI Resources
YUI Resources
http://yuilibrary.com/
http://developer.yahoo.com/yui/3/
http://github.com/yui/
http://yuiblog.com/
http://twitter.com/miraglia/yui/members
Jeff Craig () Introduction to YUI 3 May 13, 2010 10 / 21
YUI Standard Utilities
Node
Y.one(’#nav’);
Y.all(’#nav li’);
Y.one returns a ’Node’
Y.all returns a ’NodeList’
Jeff Craig () Introduction to YUI 3 May 13, 2010 11 / 21
YUI Standard Utilities
Node Methods
var input = Y.one(’input[type=text]’);
input.addClass(’hide’); // Add the ’hide’ class to the node
input.removeClass(’hide’);
input.toggleClass(’hide’);
input.get(’value’);
input.getStyle(’display’);
input.test(’.hide’); // Tests if the node matches a selctor
Jeff Craig () Introduction to YUI 3 May 13, 2010 12 / 21
YUI Standard Utilities
NodeList Methods
var items = Y.one(’li’);
items.filter(’.hidden’);
items.even().addClass(’even’);
items.odd().addClass(’odd’);
items.item(4); // NOT an array-like object
items.size();
items.each(function(item, index, list) {
// Treat this kind of like a for loop.
});
Jeff Craig () Introduction to YUI 3 May 13, 2010 13 / 21
YUI Standard Utilities
Events
Y.on(’click’, handler, ’#actionButton’);
handler = function(e) {
// e is a DOM Event Facade
// Same betwen all browsers
e.halt(); // Stop propogation and default action
e.preventDefault();
e.stopPropogation();
}
Same syntax as custom events
Support for touch events
Jeff Craig () Introduction to YUI 3 May 13, 2010 14 / 21
YUI Standard Utilities
Event Delegation
Y.delegate(’click’, handler, ’#container’, selector);
Assign one event, on the container, but only call the handler on
children that match the selector.
Jeff Craig () Introduction to YUI 3 May 13, 2010 15 / 21
YUI Standard Utilities
Event Delegation
Y.delegate(’click’, handler, ’#container’, selector);
Assign one event, on the container, but only call the handler on
children that match the selector.
Doesn’t fix non-bubbling events, like change-events in Internet
Explorer
Jeff Craig () Introduction to YUI 3 May 13, 2010 15 / 21
YUI Standard Utilities
YUI3 Templating
TEMPLATE = "<li><a href=’{link}’>{label}</a></li>";
data = {
link: "http://blog.foxxtrot.net/",
label: "My Blog"
};
Y.Lang.sub(TEMPLATE, data);
Jeff Craig () Introduction to YUI 3 May 13, 2010 16 / 21
YUI Standard Utilities
Advanced YUI3 Templating
TEMPLATE = "<li class=’{selected}’><a href=’{link}’>{label}</a
data = {
link: "http://blog.foxxtrot.net/",
label: "My Blog",
selected: true
};
Y.use(’substitutue’, function(Y) {
Y.substitute(TEMPLATE, data,
function(key, value) {
if(key === "selected") {
return value ? "selected" : "";
}
return value;
});
});
Jeff Craig () Introduction to YUI 3 May 13, 2010 17 / 21
YUI AJAX
Server Calls
Y.io("/path/to/request", {
method: ’GET’,
data: ’field1=value&field2=3’,
on: {
start: handler,
complete: handler,
success: handler,
failure: handler,
end: handler
}
sync: false,
timeout: 2000
});
Jeff Craig () Introduction to YUI 3 May 13, 2010 18 / 21
YUI AJAX
JSON
Y.JSON.stringify({
name: "Jeff Craig",
nick: "foxxtrot",
session: "Intro to YUI3"
});
Y.JSON.parse("{’event’: ’Palouse Code Camp’,
’date’: ’2010.10.30’}");
Jeff Craig () Introduction to YUI 3 May 13, 2010 19 / 21
YUI AJAX
Transistions
Y.one(’#demo’).transition({
duration: 1, // seconds
easing: ’ease-out’,
height: 0,
width: 0,
left: ’150px’,
top: ’100px’,
opacity: 0
}, function() { Y.one(’#demo’).destroy(true); } );
Jeff Craig () Introduction to YUI 3 May 13, 2010 20 / 21
YUI End Notes
Links
YUI:
http://yuilibrary.com/
http://developer.yahoo.com/yui/3/
http://github.com/yui/
http://yuiblog.com/
http://twitter.com/miraglia/yui/members
Me:
foxxtrot@foxxtrot.net
http://blog.foxxtrot.net/
twitter.com/foxxtrot
github.com/foxxtrot
Jeff Craig () Introduction to YUI 3 May 13, 2010 21 / 21

Mais conteúdo relacionado

Destaque

Adverbs of frequency
Adverbs of frequencyAdverbs of frequency
Adverbs of frequencymarielasiri
 
Asesoría en creación e implementación de Franquicias por ELG ASESORES PERÚ.
Asesoría en creación e implementación de Franquicias por ELG ASESORES PERÚ.Asesoría en creación e implementación de Franquicias por ELG ASESORES PERÚ.
Asesoría en creación e implementación de Franquicias por ELG ASESORES PERÚ.ELG Asesores PERU
 
Produttività in Italia: una chimera?
Produttività in Italia: una chimera?Produttività in Italia: una chimera?
Produttività in Italia: una chimera?Quattrogatti.info
 
Università e mercato del lavoro
Università e mercato del lavoro Università e mercato del lavoro
Università e mercato del lavoro Quattrogatti.info
 
Sky gate presentation
Sky gate presentationSky gate presentation
Sky gate presentationSachin Tomar
 

Destaque (7)

Adverbs of frequency
Adverbs of frequencyAdverbs of frequency
Adverbs of frequency
 
Asesoría en creación e implementación de Franquicias por ELG ASESORES PERÚ.
Asesoría en creación e implementación de Franquicias por ELG ASESORES PERÚ.Asesoría en creación e implementación de Franquicias por ELG ASESORES PERÚ.
Asesoría en creación e implementación de Franquicias por ELG ASESORES PERÚ.
 
Chrysler 300
Chrysler 300Chrysler 300
Chrysler 300
 
Produttività in Italia: una chimera?
Produttività in Italia: una chimera?Produttività in Italia: una chimera?
Produttività in Italia: una chimera?
 
Dyes classification
Dyes   classificationDyes   classification
Dyes classification
 
Università e mercato del lavoro
Università e mercato del lavoro Università e mercato del lavoro
Università e mercato del lavoro
 
Sky gate presentation
Sky gate presentationSky gate presentation
Sky gate presentation
 

Semelhante a Introduction to YUI3 - Palouse Code Camp 2010

Advanced YUI3: Module Creation and the Component Infrastructure
Advanced YUI3: Module Creation and the Component InfrastructureAdvanced YUI3: Module Creation and the Component Infrastructure
Advanced YUI3: Module Creation and the Component InfrastructureJeff Craig
 
YUI 3 Loading Strategies - YUIConf2010
YUI 3 Loading Strategies - YUIConf2010YUI 3 Loading Strategies - YUIConf2010
YUI 3 Loading Strategies - YUIConf2010Caridy Patino
 
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 2012Eduardo Lundgren
 
Creating custom modules using YUI3
Creating custom modules using YUI3Creating custom modules using YUI3
Creating custom modules using YUI3Gonzalo Cordero
 
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !Joseph Chiang
 
YUI Test The Next Generation (YUIConf 2010)
YUI Test The Next Generation (YUIConf 2010)YUI Test The Next Generation (YUIConf 2010)
YUI Test The Next Generation (YUIConf 2010)Nicholas Zakas
 
Build your web apps with yql and yui
Build your web apps with yql and yuiBuild your web apps with yql and yui
Build your web apps with yql and yuiISOCHK
 
Making Rich Internet Applications Accessible Through jQuery
Making Rich Internet Applications Accessible Through jQueryMaking Rich Internet Applications Accessible Through jQuery
Making Rich Internet Applications Accessible Through jQueryAEGIS-ACCESSIBLE Projects
 
Sakai uPortal Integration Options
Sakai uPortal Integration OptionsSakai uPortal Integration Options
Sakai uPortal Integration OptionsJohn Lewis
 
Y hack-china-2013
Y hack-china-2013Y hack-china-2013
Y hack-china-2013Syu-jhih Wu
 
Feature Bits at LSSC10
Feature  Bits at LSSC10Feature  Bits at LSSC10
Feature Bits at LSSC10Erik Sowa
 
Introduction to YUI - IIT Kharagpur
Introduction to YUI - IIT KharagpurIntroduction to YUI - IIT Kharagpur
Introduction to YUI - IIT KharagpurHarsha Vashisht
 
Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010Adam Moore
 
Feature Bits at DevOpsDays 2010 US
Feature Bits at DevOpsDays 2010 USFeature Bits at DevOpsDays 2010 US
Feature Bits at DevOpsDays 2010 USErik Sowa
 

Semelhante a Introduction to YUI3 - Palouse Code Camp 2010 (20)

Advanced YUI3: Module Creation and the Component Infrastructure
Advanced YUI3: Module Creation and the Component InfrastructureAdvanced YUI3: Module Creation and the Component Infrastructure
Advanced YUI3: Module Creation and the Component Infrastructure
 
YUI open for all !
YUI open for all !YUI open for all !
YUI open for all !
 
YUI 3 Loading Strategies - YUIConf2010
YUI 3 Loading Strategies - YUIConf2010YUI 3 Loading Strategies - YUIConf2010
YUI 3 Loading Strategies - YUIConf2010
 
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
 
Creating custom modules using YUI3
Creating custom modules using YUI3Creating custom modules using YUI3
Creating custom modules using YUI3
 
Yui intro
Yui introYui intro
Yui intro
 
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
 
YUI Test The Next Generation (YUIConf 2010)
YUI Test The Next Generation (YUIConf 2010)YUI Test The Next Generation (YUIConf 2010)
YUI Test The Next Generation (YUIConf 2010)
 
Build your web apps with yql and yui
Build your web apps with yql and yuiBuild your web apps with yql and yui
Build your web apps with yql and yui
 
Hack with YUI
Hack with YUIHack with YUI
Hack with YUI
 
Making Rich Internet Applications Accessible Through jQuery
Making Rich Internet Applications Accessible Through jQueryMaking Rich Internet Applications Accessible Through jQuery
Making Rich Internet Applications Accessible Through jQuery
 
Introduction to YUI
Introduction to YUIIntroduction to YUI
Introduction to YUI
 
Sakai uPortal Integration Options
Sakai uPortal Integration OptionsSakai uPortal Integration Options
Sakai uPortal Integration Options
 
Y hack-china-2013
Y hack-china-2013Y hack-china-2013
Y hack-china-2013
 
Feature Bits at LSSC10
Feature  Bits at LSSC10Feature  Bits at LSSC10
Feature Bits at LSSC10
 
Yui mixer
Yui mixerYui mixer
Yui mixer
 
Introduction to YUI - IIT Kharagpur
Introduction to YUI - IIT KharagpurIntroduction to YUI - IIT Kharagpur
Introduction to YUI - IIT Kharagpur
 
Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010
 
YUI3 - IIT Madras HackU
YUI3 - IIT Madras HackU YUI3 - IIT Madras HackU
YUI3 - IIT Madras HackU
 
Feature Bits at DevOpsDays 2010 US
Feature Bits at DevOpsDays 2010 USFeature Bits at DevOpsDays 2010 US
Feature Bits at DevOpsDays 2010 US
 

Último

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Introduction to YUI3 - Palouse Code Camp 2010

  • 1. Introduction to YUI 3 Jeff Craig May 13, 2010 Jeff Craig () Introduction to YUI 3 May 13, 2010 1 / 21
  • 2. About Me Who am I? Software Developer at Washington State University Contact: foxxtrot@foxxtrot.net http://blog.foxxtrot.net/ twitter.com/foxxtrot github.com/foxxtrot Jeff Craig () Introduction to YUI 3 May 13, 2010 2 / 21
  • 3. YUI What What is YUI? Housed and Developed at Yahoo! YUI2 Released in 2006, still actively supported YUI3 launched late 2009 Used across most Yahoo! properties, new development is in YUI3 Designed to be scalable, fast, secure, and modular Jeff Craig () Introduction to YUI 3 May 13, 2010 3 / 21
  • 4. YUI What YUI3 Structure Core Component Infrastructure Utilities Widgets Developer Tools Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
  • 5. YUI What YUI3 Structure Core Lang, UA, Queue, Object, Get, Array, Node, Event Component Infrastructure Utilities Widgets Developer Tools Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
  • 6. YUI What YUI3 Structure Core Component Infrastructure Base, Attribute, Plugin, Widget Utilities Widgets Developer Tools Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
  • 7. YUI What YUI3 Structure Core Component Infrastructure Utilities Animation, Cache, Cookie, DataSchema, IO, JSON, ImageLoader, Internationalization, etc. Widgets Developer Tools Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
  • 8. YUI What YUI3 Structure Core Component Infrastructure Utilities Widgets Overlay, Slider, TabView, GridView Developer Tools Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
  • 9. YUI What YUI3 Structure Core Component Infrastructure Utilities Widgets Developer Tools Console, Profiler, Test Jeff Craig () Introduction to YUI 3 May 13, 2010 4 / 21
  • 10. YUI Why? Why YUI3? Modular: Load only the code you need. Flexible: Base functionality provides flexible Attribute and Plugin systems Complete: Tons of utilities available now, and widgets are coming Fast: Demonstrable faster at common tasks, and fast enough for one of the worlds largest websites. Jeff Craig () Introduction to YUI 3 May 13, 2010 5 / 21
  • 11. YUI Why Not? Why not YUI3? Your existing codebase works Many widgets haven’t been ported yet. Jeff Craig () Introduction to YUI 3 May 13, 2010 6 / 21
  • 12. YUI Why Not? Why not YUI3? Your existing codebase works Many widgets haven’t been ported yet. Some will not be. Jeff Craig () Introduction to YUI 3 May 13, 2010 6 / 21
  • 13. YUI SimpleYUI SimpleYUI Introduced with YUI 3.2 Eliminates the Sandbox Fastest way to get started with YUI3 Provides Node/Events, Transitions, IO Jeff Craig () Introduction to YUI 3 May 13, 2010 7 / 21
  • 14. YUI SimpleYUI Why not use SimpleYUI? There are performance benefits to using the module pattern There is safety in the sandbox You have more control in standard YUI Jeff Craig () Introduction to YUI 3 May 13, 2010 8 / 21
  • 15. YUI Community YUI3 and the Community With YUI3, the team refocused on open-source. They launched YUI3 with a public bug tracker and forums, and put the source up on GitHub. In October 2009, the Gallery launched, providing a mechanism for modules to be shared easily outside of the core of YUI, including offering hosting on the Yahoo! CDN for modules, and easy inclusion within YUI3 projects. In early 2010, the YUI Team began hosting ”YUI Open Hours” a periodic conference call. Jeff Craig () Introduction to YUI 3 May 13, 2010 9 / 21
  • 17. YUI Standard Utilities Node Y.one(’#nav’); Y.all(’#nav li’); Y.one returns a ’Node’ Y.all returns a ’NodeList’ Jeff Craig () Introduction to YUI 3 May 13, 2010 11 / 21
  • 18. YUI Standard Utilities Node Methods var input = Y.one(’input[type=text]’); input.addClass(’hide’); // Add the ’hide’ class to the node input.removeClass(’hide’); input.toggleClass(’hide’); input.get(’value’); input.getStyle(’display’); input.test(’.hide’); // Tests if the node matches a selctor Jeff Craig () Introduction to YUI 3 May 13, 2010 12 / 21
  • 19. YUI Standard Utilities NodeList Methods var items = Y.one(’li’); items.filter(’.hidden’); items.even().addClass(’even’); items.odd().addClass(’odd’); items.item(4); // NOT an array-like object items.size(); items.each(function(item, index, list) { // Treat this kind of like a for loop. }); Jeff Craig () Introduction to YUI 3 May 13, 2010 13 / 21
  • 20. YUI Standard Utilities Events Y.on(’click’, handler, ’#actionButton’); handler = function(e) { // e is a DOM Event Facade // Same betwen all browsers e.halt(); // Stop propogation and default action e.preventDefault(); e.stopPropogation(); } Same syntax as custom events Support for touch events Jeff Craig () Introduction to YUI 3 May 13, 2010 14 / 21
  • 21. YUI Standard Utilities Event Delegation Y.delegate(’click’, handler, ’#container’, selector); Assign one event, on the container, but only call the handler on children that match the selector. Jeff Craig () Introduction to YUI 3 May 13, 2010 15 / 21
  • 22. YUI Standard Utilities Event Delegation Y.delegate(’click’, handler, ’#container’, selector); Assign one event, on the container, but only call the handler on children that match the selector. Doesn’t fix non-bubbling events, like change-events in Internet Explorer Jeff Craig () Introduction to YUI 3 May 13, 2010 15 / 21
  • 23. YUI Standard Utilities YUI3 Templating TEMPLATE = "<li><a href=’{link}’>{label}</a></li>"; data = { link: "http://blog.foxxtrot.net/", label: "My Blog" }; Y.Lang.sub(TEMPLATE, data); Jeff Craig () Introduction to YUI 3 May 13, 2010 16 / 21
  • 24. YUI Standard Utilities Advanced YUI3 Templating TEMPLATE = "<li class=’{selected}’><a href=’{link}’>{label}</a data = { link: "http://blog.foxxtrot.net/", label: "My Blog", selected: true }; Y.use(’substitutue’, function(Y) { Y.substitute(TEMPLATE, data, function(key, value) { if(key === "selected") { return value ? "selected" : ""; } return value; }); }); Jeff Craig () Introduction to YUI 3 May 13, 2010 17 / 21
  • 25. YUI AJAX Server Calls Y.io("/path/to/request", { method: ’GET’, data: ’field1=value&field2=3’, on: { start: handler, complete: handler, success: handler, failure: handler, end: handler } sync: false, timeout: 2000 }); Jeff Craig () Introduction to YUI 3 May 13, 2010 18 / 21
  • 26. YUI AJAX JSON Y.JSON.stringify({ name: "Jeff Craig", nick: "foxxtrot", session: "Intro to YUI3" }); Y.JSON.parse("{’event’: ’Palouse Code Camp’, ’date’: ’2010.10.30’}"); Jeff Craig () Introduction to YUI 3 May 13, 2010 19 / 21
  • 27. YUI AJAX Transistions Y.one(’#demo’).transition({ duration: 1, // seconds easing: ’ease-out’, height: 0, width: 0, left: ’150px’, top: ’100px’, opacity: 0 }, function() { Y.one(’#demo’).destroy(true); } ); Jeff Craig () Introduction to YUI 3 May 13, 2010 20 / 21