SlideShare a Scribd company logo
Essential YUI
  {   An introduction to Yahoo!’s JavaScript library
      Derrick McMillen, March 2012
Why do we need libraries?
• The DOM is difficult to use, verbose,
  and inconsistent (see DOM levels).
• We must always respect the global
  namespace !
• Building advanced web applications
  requires abstraction.
• Leveraging other developer’s code
  makes our lives easier.
The Yahoo! User Interface
library is a tool to help you
avoid these pitfalls!
The YUI Seed
<html>
<body>
    <!-- your page content -->
    <!-- YUI seed-->
    <script src=‚…"></script>
    <script src=‚…">
        // your JavaScript
    </script>
</body>
</html>
Quiz
// finds the greatest common divisor
function gcd(a, b) {
     if(b === 0)
          return a;
     else {
          x = a % b;
          return gcd(b, x);
     }
}

x = 5;
y = gcd(12, 4) + x; // what is y?
The YUI Loader
YUI().use(‘node’, function(Y) {

      Y.log(‚Hello world!‛);
});
DOM nodes

var d = document;

var body = d.getElementsByTagName(‘body’)[0],
p = d.createElement(‘p’),
txt = d.createTextNode(‘Hello world!’);

body.appendChild(p.appendChild(txt));
DOM nodes

YUI().use(‘node’, function(Y) {

  var body = Y.one(‘body’);
  body.append(Y.Node.create(
              ‘<p>Hello world!</p>’);

});
DOM Events

YUI().use(‘event’, function(Y) {

  var button = Y.one(‘#button’);

  Y.on(‘click’, function(e) {
     alert(‘hello’);
  });
});
DOM Events
YUI().use(‘event’, function(Y) {

  var mask = Y.one(‘#mask’);

  Y.on(‘click’, function(e) {

     e.preventDefault();
     mask.show();
  }, ‘a#button’);
});
Ajax
YUI().use(‘io’, function(Y) {

 var handler = function(id, o, args) {
    Y.one(‘body’).append(o.responseText);
 });

 Y.on(‘io:complete’, handler);

  Y.io(‘/users/profile?user_name=derrick’);
});
Objected Oriented
JavaScript without YUI
Pseudo-classical
Inheritance
var Animal = function(n) {
     var noise = n;
     this.makeNoise = function() {
          alert(noise);
     }
};

var Dog = function () {
     this.bark = function() {
          this.makeNoise();
     }
};

Dog.prototype = new Animal(‘woof!’);
var Mammal = function() {
     this.baby = function() {
          return new Mammal();
     }
};

Mammal.prototype = new Animal(); // uh oh…
Dog.prototype = new Mammal(‘woof!’);
fido = new Dog();
fido.bark(); // undefined

fido instanceof Dog    //true
fido instanceof Mammal // true
fido instanceof Animal //true
The Prototype Chain
      Animal
                   What happened when fido.bark() ?
      noise
      makeNoise
      __proto__      We were unable to { }
                                        provide the
                     instance of Animal the correct
      Mammal         argument when instanciated.

      baby
      __proto__      The noise private field was
                     never set.

      Dog (fido)

      bark
      __proto__
Objected Oriented
JavaScript with YUI
YUI OO Utilities
• Native JavaScript OO
   • Y.extend (pseudo-classical)
   • Y.Object (prototypal)

• Synthetic OO
   • Y.augment (multiple inheritance)
   • Y.Plugin (expressive, flexible)
   • Y.Base (feature rich out-of-the-box)
var Animal = function(n) {
     var noise = n;
     this.makeNoise = function() {
          alert(noise);
     }
};
var Dog = function () {
     Dog.superclass.constructor.apply(this,
                            arguments);
     this.bark = function() {
          this.makeNoise();
     }
};

Y.extend(Dog, Animal);
YUI Widgets from
Yahoo!’s CDN
You may retrieve any modules available
on the Yahoo! CDN using the YUI loader.



YUI().use(‘datatable’, …);

YUI().use(‘panel’, …);
Check it out!

    yuilibrary.com

Hundreds of fantastic
 video presentations!

yuilibrary.com/theater

More Related Content

What's hot

Steam Learn: Javascript and OOP
Steam Learn: Javascript and OOPSteam Learn: Javascript and OOP
Steam Learn: Javascript and OOP
inovia
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
Pradeep Saraswathi
 
Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)
Gesh Markov
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
Mike Whitaker
 
You are in a maze of deeply nested maps, all alike
You are in a maze of deeply nested maps, all alikeYou are in a maze of deeply nested maps, all alike
You are in a maze of deeply nested maps, all alike
Eric Normand
 
201705 metaprogramming in julia
201705 metaprogramming in julia201705 metaprogramming in julia
201705 metaprogramming in julia
岳華 杜
 
Minimizing Decision Fatigue to Improve Team Productivity
Minimizing Decision Fatigue to Improve Team ProductivityMinimizing Decision Fatigue to Improve Team Productivity
Minimizing Decision Fatigue to Improve Team Productivity
Derek Lee Boire
 
Writing Clean Code in Swift
Writing Clean Code in SwiftWriting Clean Code in Swift
Writing Clean Code in Swift
Derek Lee Boire
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
kchodorow
 
Trimming The Cruft
Trimming The CruftTrimming The Cruft
Trimming The Cruft
Peter Higgins
 
Voyage by example
Voyage by exampleVoyage by example
Voyage by example
Esteban Lorenzano
 
Andreas Roth - GraphQL erfolgreich im Backend einsetzen
Andreas Roth - GraphQL erfolgreich im Backend einsetzenAndreas Roth - GraphQL erfolgreich im Backend einsetzen
Andreas Roth - GraphQL erfolgreich im Backend einsetzen
DevDay Dresden
 
dojo.things()
dojo.things()dojo.things()
dojo.things()
Peter Higgins
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
Remy Sharp
 
Jquery optimization-tips
Jquery optimization-tipsJquery optimization-tips
Jquery optimization-tips
anubavam-techkt
 
Java & Script ─ 清羽
Java & Script ─ 清羽Java & Script ─ 清羽
Java & Script ─ 清羽
taobao.com
 
Learning How To Use Jquery #5
Learning How To Use Jquery #5Learning How To Use Jquery #5
Learning How To Use Jquery #5
Takahiro Yoshimura
 
Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発
swdyh
 
History of jQuery
History of jQueryHistory of jQuery
History of jQuery
jeresig
 
Advanced Debugging with Xcode - Extending LLDB
Advanced Debugging with Xcode - Extending LLDBAdvanced Debugging with Xcode - Extending LLDB
Advanced Debugging with Xcode - Extending LLDB
Aijaz Ansari
 

What's hot (20)

Steam Learn: Javascript and OOP
Steam Learn: Javascript and OOPSteam Learn: Javascript and OOP
Steam Learn: Javascript and OOP
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)Kotlin For Android - Functions (part 3 of 7)
Kotlin For Android - Functions (part 3 of 7)
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
 
You are in a maze of deeply nested maps, all alike
You are in a maze of deeply nested maps, all alikeYou are in a maze of deeply nested maps, all alike
You are in a maze of deeply nested maps, all alike
 
201705 metaprogramming in julia
201705 metaprogramming in julia201705 metaprogramming in julia
201705 metaprogramming in julia
 
Minimizing Decision Fatigue to Improve Team Productivity
Minimizing Decision Fatigue to Improve Team ProductivityMinimizing Decision Fatigue to Improve Team Productivity
Minimizing Decision Fatigue to Improve Team Productivity
 
Writing Clean Code in Swift
Writing Clean Code in SwiftWriting Clean Code in Swift
Writing Clean Code in Swift
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
Trimming The Cruft
Trimming The CruftTrimming The Cruft
Trimming The Cruft
 
Voyage by example
Voyage by exampleVoyage by example
Voyage by example
 
Andreas Roth - GraphQL erfolgreich im Backend einsetzen
Andreas Roth - GraphQL erfolgreich im Backend einsetzenAndreas Roth - GraphQL erfolgreich im Backend einsetzen
Andreas Roth - GraphQL erfolgreich im Backend einsetzen
 
dojo.things()
dojo.things()dojo.things()
dojo.things()
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
Jquery optimization-tips
Jquery optimization-tipsJquery optimization-tips
Jquery optimization-tips
 
Java & Script ─ 清羽
Java & Script ─ 清羽Java & Script ─ 清羽
Java & Script ─ 清羽
 
Learning How To Use Jquery #5
Learning How To Use Jquery #5Learning How To Use Jquery #5
Learning How To Use Jquery #5
 
Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発
 
History of jQuery
History of jQueryHistory of jQuery
History of jQuery
 
Advanced Debugging with Xcode - Extending LLDB
Advanced Debugging with Xcode - Extending LLDBAdvanced Debugging with Xcode - Extending LLDB
Advanced Debugging with Xcode - Extending LLDB
 

Viewers also liked

Yui css
Yui cssYui css
Yui css
darkangel7861
 
Budgeting
BudgetingBudgeting
Budgeting
conornorton
 
Presentatie1 voor slideshare
Presentatie1 voor slidesharePresentatie1 voor slideshare
Presentatie1 voor slideshareStijn Willems
 
Industry
IndustryIndustry
Industry
priyase
 
Making API documentation work
Making API documentation workMaking API documentation work
Making API documentation work
Desiree Zamora Garcia
 
Yovita kristin (090210302079)
Yovita kristin (090210302079)Yovita kristin (090210302079)
Yovita kristin (090210302079)Vichrista Arista
 
Media evaluation
Media evaluationMedia evaluation
Media evaluation
Lewis Bancroft
 
Regresiones, de Vicente Muñoz Ávarez
Regresiones, de Vicente Muñoz ÁvarezRegresiones, de Vicente Muñoz Ávarez
Regresiones, de Vicente Muñoz Ávarez
Ana R. Otero
 
세바기(세상을 바꾸는 기술)_변화를 위한 무한도전
세바기(세상을 바꾸는 기술)_변화를 위한 무한도전세바기(세상을 바꾸는 기술)_변화를 위한 무한도전
세바기(세상을 바꾸는 기술)_변화를 위한 무한도전
S.K. Cha of ACS in Korea
 
Designing a "nutrition facts" label for disclosing prepaid card fees
Designing a "nutrition facts" label for disclosing prepaid card feesDesigning a "nutrition facts" label for disclosing prepaid card fees
Designing a "nutrition facts" label for disclosing prepaid card fees
Desiree Zamora Garcia
 
Industry
IndustryIndustry
Industry
priyase
 
Analsisis pisa
Analsisis pisaAnalsisis pisa
Analsisis pisa
suryo purnomo
 
S ilabus tik smp berkarakter kelas 7 sd 9
S ilabus tik smp berkarakter kelas 7 sd 9S ilabus tik smp berkarakter kelas 7 sd 9
S ilabus tik smp berkarakter kelas 7 sd 9
suryo purnomo
 
e-Manufacturing; before and after
e-Manufacturing; before and aftere-Manufacturing; before and after
e-Manufacturing; before and after
S.K. Cha of ACS in Korea
 
mes와 fems을 활용한 생산공장 에너지효율화
 mes와 fems을 활용한 생산공장 에너지효율화 mes와 fems을 활용한 생산공장 에너지효율화
mes와 fems을 활용한 생산공장 에너지효율화
S.K. Cha of ACS in Korea
 

Viewers also liked (17)

Ciparay
CiparayCiparay
Ciparay
 
Yui css
Yui cssYui css
Yui css
 
Budgeting
BudgetingBudgeting
Budgeting
 
Presentatie1 voor slideshare
Presentatie1 voor slidesharePresentatie1 voor slideshare
Presentatie1 voor slideshare
 
Industry
IndustryIndustry
Industry
 
111
111111
111
 
Making API documentation work
Making API documentation workMaking API documentation work
Making API documentation work
 
Yovita kristin (090210302079)
Yovita kristin (090210302079)Yovita kristin (090210302079)
Yovita kristin (090210302079)
 
Media evaluation
Media evaluationMedia evaluation
Media evaluation
 
Regresiones, de Vicente Muñoz Ávarez
Regresiones, de Vicente Muñoz ÁvarezRegresiones, de Vicente Muñoz Ávarez
Regresiones, de Vicente Muñoz Ávarez
 
세바기(세상을 바꾸는 기술)_변화를 위한 무한도전
세바기(세상을 바꾸는 기술)_변화를 위한 무한도전세바기(세상을 바꾸는 기술)_변화를 위한 무한도전
세바기(세상을 바꾸는 기술)_변화를 위한 무한도전
 
Designing a "nutrition facts" label for disclosing prepaid card fees
Designing a "nutrition facts" label for disclosing prepaid card feesDesigning a "nutrition facts" label for disclosing prepaid card fees
Designing a "nutrition facts" label for disclosing prepaid card fees
 
Industry
IndustryIndustry
Industry
 
Analsisis pisa
Analsisis pisaAnalsisis pisa
Analsisis pisa
 
S ilabus tik smp berkarakter kelas 7 sd 9
S ilabus tik smp berkarakter kelas 7 sd 9S ilabus tik smp berkarakter kelas 7 sd 9
S ilabus tik smp berkarakter kelas 7 sd 9
 
e-Manufacturing; before and after
e-Manufacturing; before and aftere-Manufacturing; before and after
e-Manufacturing; before and after
 
mes와 fems을 활용한 생산공장 에너지효율화
 mes와 fems을 활용한 생산공장 에너지효율화 mes와 fems을 활용한 생산공장 에너지효율화
mes와 fems을 활용한 생산공장 에너지효율화
 

Similar to Essential YUI

Get started with YUI
Get started with YUIGet started with YUI
Get started with YUI
Adam Lu
 
YUI Hidden Gems
YUI Hidden GemsYUI Hidden Gems
YUI Hidden Gems
Andrew Wooldridge
 
Geekup Leeds - Why the YUI?
Geekup Leeds - Why the YUI?Geekup Leeds - Why the YUI?
Geekup Leeds - Why the YUI?
Christian Heilmann
 
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
 
Objective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET DevelopersObjective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET Developers
Ben Scheirman
 
YUI (Advanced)
YUI (Advanced)YUI (Advanced)
YUI (Advanced)
Jai Santhosh
 
Developing Useful APIs
Developing Useful APIsDeveloping Useful APIs
Developing Useful APIs
Dmitry Buzdin
 
Embracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend PerfEmbracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend Perf
Morgan Cheng
 
2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui
JH Lee
 
Object-oriented Basics
Object-oriented BasicsObject-oriented Basics
Object-oriented Basics
Jamie (Taka) Wang
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
Peter Higgins
 
YUI for your Hacks
YUI for your Hacks YUI for your Hacks
YUI for your Hacks
Subramanyan Murali
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
Thomas Kjeldahl Nilsson
 
Origins of Elixir programming language
Origins of Elixir programming languageOrigins of Elixir programming language
Origins of Elixir programming language
Pivorak MeetUp
 
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
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012
Nicholas Zakas
 
Jeff English: Demystifying Module Development - How to Extend Titanium
Jeff English: Demystifying Module Development - How to Extend TitaniumJeff English: Demystifying Module Development - How to Extend Titanium
Jeff English: Demystifying Module Development - How to Extend Titanium
Axway Appcelerator
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
Jussi Pohjolainen
 
Solving Problems with YUI3: AutoComplete
Solving Problems with YUI3: AutoCompleteSolving Problems with YUI3: AutoComplete
Solving Problems with YUI3: AutoComplete
IsaacSchlueter
 
YUI on the go
YUI on the goYUI on the go
YUI on the go
Christian Heilmann
 

Similar to Essential YUI (20)

Get started with YUI
Get started with YUIGet started with YUI
Get started with YUI
 
YUI Hidden Gems
YUI Hidden GemsYUI Hidden Gems
YUI Hidden Gems
 
Geekup Leeds - Why the YUI?
Geekup Leeds - Why the YUI?Geekup Leeds - Why the YUI?
Geekup Leeds - Why the YUI?
 
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
 
Objective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET DevelopersObjective-C & iPhone for .NET Developers
Objective-C & iPhone for .NET Developers
 
YUI (Advanced)
YUI (Advanced)YUI (Advanced)
YUI (Advanced)
 
Developing Useful APIs
Developing Useful APIsDeveloping Useful APIs
Developing Useful APIs
 
Embracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend PerfEmbracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend Perf
 
2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui
 
Object-oriented Basics
Object-oriented BasicsObject-oriented Basics
Object-oriented Basics
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
 
YUI for your Hacks
YUI for your Hacks YUI for your Hacks
YUI for your Hacks
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
 
Origins of Elixir programming language
Origins of Elixir programming languageOrigins of Elixir programming language
Origins of Elixir programming language
 
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
 
Maintainable JavaScript 2012
Maintainable JavaScript 2012Maintainable JavaScript 2012
Maintainable JavaScript 2012
 
Jeff English: Demystifying Module Development - How to Extend Titanium
Jeff English: Demystifying Module Development - How to Extend TitaniumJeff English: Demystifying Module Development - How to Extend Titanium
Jeff English: Demystifying Module Development - How to Extend Titanium
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
Solving Problems with YUI3: AutoComplete
Solving Problems with YUI3: AutoCompleteSolving Problems with YUI3: AutoComplete
Solving Problems with YUI3: AutoComplete
 
YUI on the go
YUI on the goYUI on the go
YUI on the go
 

Recently uploaded

UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 

Recently uploaded (20)

UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 

Essential YUI

  • 1. Essential YUI { An introduction to Yahoo!’s JavaScript library Derrick McMillen, March 2012
  • 2. Why do we need libraries? • The DOM is difficult to use, verbose, and inconsistent (see DOM levels). • We must always respect the global namespace ! • Building advanced web applications requires abstraction. • Leveraging other developer’s code makes our lives easier.
  • 3. The Yahoo! User Interface library is a tool to help you avoid these pitfalls!
  • 4. The YUI Seed <html> <body> <!-- your page content --> <!-- YUI seed--> <script src=‚…"></script> <script src=‚…"> // your JavaScript </script> </body> </html>
  • 5. Quiz // finds the greatest common divisor function gcd(a, b) { if(b === 0) return a; else { x = a % b; return gcd(b, x); } } x = 5; y = gcd(12, 4) + x; // what is y?
  • 6. The YUI Loader YUI().use(‘node’, function(Y) { Y.log(‚Hello world!‛); });
  • 7. DOM nodes var d = document; var body = d.getElementsByTagName(‘body’)[0], p = d.createElement(‘p’), txt = d.createTextNode(‘Hello world!’); body.appendChild(p.appendChild(txt));
  • 8. DOM nodes YUI().use(‘node’, function(Y) { var body = Y.one(‘body’); body.append(Y.Node.create( ‘<p>Hello world!</p>’); });
  • 9. DOM Events YUI().use(‘event’, function(Y) { var button = Y.one(‘#button’); Y.on(‘click’, function(e) { alert(‘hello’); }); });
  • 10. DOM Events YUI().use(‘event’, function(Y) { var mask = Y.one(‘#mask’); Y.on(‘click’, function(e) { e.preventDefault(); mask.show(); }, ‘a#button’); });
  • 11. Ajax YUI().use(‘io’, function(Y) { var handler = function(id, o, args) { Y.one(‘body’).append(o.responseText); }); Y.on(‘io:complete’, handler); Y.io(‘/users/profile?user_name=derrick’); });
  • 14. var Animal = function(n) { var noise = n; this.makeNoise = function() { alert(noise); } }; var Dog = function () { this.bark = function() { this.makeNoise(); } }; Dog.prototype = new Animal(‘woof!’);
  • 15. var Mammal = function() { this.baby = function() { return new Mammal(); } }; Mammal.prototype = new Animal(); // uh oh… Dog.prototype = new Mammal(‘woof!’); fido = new Dog(); fido.bark(); // undefined fido instanceof Dog //true fido instanceof Mammal // true fido instanceof Animal //true
  • 16. The Prototype Chain Animal What happened when fido.bark() ? noise makeNoise __proto__ We were unable to { } provide the instance of Animal the correct Mammal argument when instanciated. baby __proto__ The noise private field was never set. Dog (fido) bark __proto__
  • 18. YUI OO Utilities • Native JavaScript OO • Y.extend (pseudo-classical) • Y.Object (prototypal) • Synthetic OO • Y.augment (multiple inheritance) • Y.Plugin (expressive, flexible) • Y.Base (feature rich out-of-the-box)
  • 19. var Animal = function(n) { var noise = n; this.makeNoise = function() { alert(noise); } }; var Dog = function () { Dog.superclass.constructor.apply(this, arguments); this.bark = function() { this.makeNoise(); } }; Y.extend(Dog, Animal);
  • 21. You may retrieve any modules available on the Yahoo! CDN using the YUI loader. YUI().use(‘datatable’, …); YUI().use(‘panel’, …);
  • 22. Check it out! yuilibrary.com Hundreds of fantastic video presentations! yuilibrary.com/theater