SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
YUI3 : MODULES
                            Base - Plugin - Widget




Wednesday, June 8, 2011
CLASS CREATION

Wednesday, June 8, 2011
CLASS OBJECTS
    Constructor Functions
               function wooga() {}

               var wooga = function(){};




Wednesday, June 8, 2011
PROPERTIES
    function Fooga() {
        this.wooga = 'wooga';
    }

    Fooga.PI = Math.PI;

    Fooga.prototype.nooga = function(){
        return 42;
    };




Wednesday, June 8, 2011
EXTENDING
    function Fooga() {
        Y.log('Fooga constructor');
    }

    function Hooga() {
        Y.log('Hooga constructor');
        Hooga.superclass.constructor.apply(this, arguments);
    }

    Y.extend(Hooga, Fooga);




Wednesday, June 8, 2011
MIXING
    function Hooga() {}
    Hooga.prototype.fooga = 'wooga';

    function Nooga() {}
    Nooga.prototype.fooga = null;

    Y.mix(Hooga, Nooga);

    var h = new Hooga();
    Y.log(h.fooga); // 'wooga'

    Y.mix(Hooga, Nooga, true, null, 2); // allow override. set mode to
    prototype (2)

    var h2 = new Hooga();
    Y.log(h2.fooga); // null


Wednesday, June 8, 2011
EXAMPLE
    function Fooga() {
        Fooga.superclass.constructor.apply(this, arguments);
    }

    Fooga.NAME = 'fooga';

    Fooga.ATTRS = {
        timer : {
            value : 2000
        }
    };

    Y.extend(Fooga, Y.Base);

    Y.mix(Fooga, Y.io);




Wednesday, June 8, 2011
BASE

Wednesday, June 8, 2011
UNDER THE HOOD

    • Event Target              - publish(), fire(), once(), before(), on(), after()

    • Attribute  - set(), get(), value, valueFn, setter, getter, validator,
       readOnly, writeOnce

    • Plugin              Host - plug(), unplug(), hasPlugin()




Wednesday, June 8, 2011
METHODS

    • Static          - create(), mix(), plug(), unplug()

    • Life        Cycle - init(), destroy()




Wednesday, June 8, 2011
EVENTS AND CONFIG

    • Configuration               - initialize, destroyed

    • Events              - init, initializedChange, destroy, destroyedChange




Wednesday, June 8, 2011
EXAMPLE
    YUI.add('calc', function(Y){

           Y.Calc = Y.Base.create('calc', Y.Base, [], {

                  add : function() {
                      var total = this.get('total'),
                          args = arguments;

                          Y.Array.each(args, function(val) {
                              total += parseFloat(val, 10);
                          });

                          this.set('total', total);
                          return total;
                  }

           }, {
                  ATTRS : {
                      total : {
                          value : 0
                      }
                  }
           });

    }, '1.0.0', { requires: ['base'] });

Wednesday, June 8, 2011
PLUGIN

Wednesday, June 8, 2011
LIFE CYCLE

    • initializer         - fired on plug()

    • destructor           - fired on unplug()




Wednesday, June 8, 2011
METHODS

    • Life        Cycle - initializer(), destructor()

    • Host           Method - beforeHostMethod(), afterHostMethod()

    • Host           Event - onHostEvent(), afterHostEvent()




Wednesday, June 8, 2011
EVENTS AND CONFIG

    • host          - object that gets plugged

    • hostChange           - fires when the host has changed




Wednesday, June 8, 2011
EXAMPLE
    YUI.add('my-plugin', function(Y){

          Y.Plugin.MyPlugin = Y.Base.create('my-plugin', Y.Plugin.Base, [], {

                 _clickHandle : null,
                 initializer : function() {
                     this._bindUI();
                 },
                 destructor : function() {
                     var handle = this._clickHandle;
                     if (handle) {
                         handle.detach();
                     }
                 },
                 _bindUI : function() {
                     this._clickHandle = this.get('host').on('click', this._preventClick, this);
                 },
                 _preventClick : function(e) {
                     e.preventDefault();
                     Y.log('click prevented');
                 }

          }, {
                 NS : 'my-plugin',
                 ATTRS : {}
          });

    }, '1.0.0', { requires: ['plugin', 'base-build'] });



Wednesday, June 8, 2011
WIDGET

Wednesday, June 8, 2011
LIFE CYCLE

    • initializer

    • render

             • renderUI

             • bindUI

             • syncUI

    • destructor

Wednesday, June 8, 2011
METHODS

    • focus           - blur(), focus()

    • enable              - enable(), disable()

    • show            - show(), hide()

    • getClassName()

    • getSkinName()




Wednesday, June 8, 2011
EVENTS AND CONFIG

    • boundingBox                  • boundingBoxChange

    • contentBox                   • contentBoxChange

    • srcNode                      • srcNodeChange

    • tabIndex                     • tabIndexChange

    • rendered                     • renderedChange

    • visible                      • visibleChange

Wednesday, June 8, 2011
EXAMPLE
    YUI.add('my-widget', function(Y){

          Y.MyWidget = Y.Base.create('my-widget', Y.Widget, [], {

                 renderUI : function() {
                     var cb = this.get('contentBox');
                     cb.append(Y.Node.create('<strong />'));
                     cb.one('strong').setContent(this.get('content'));
                 },
                 bindUI : function() {
                     var strongNode = this.get('contentBox').one('strong');
                     strongNode.on('click', function(e){
                         e.currentTarget.toggleClass('blue');
                     });
                 }

          }, {
                 ATTRS : {
                     content : {
                         value : 'Widget Content'
                     }
                 }
          });

    }, '1.0.0', { requires: ['widget', 'base-build'] });




Wednesday, June 8, 2011
PLUGIN OR EXTENSION

    • Plug         when you:                • Extend   when you:

             • Want    to add or remove        • Want   to keep the
                 features during run time        functionality across all
                                                 instances
             • Want     to mix features
                 per instance                  • Want   to mix features
                                                 into a new object




Wednesday, June 8, 2011
QUESTIONS?
    Anthony Pipkin
    @apipkin
    IRC: apipkin
    meebo: a.pipkin

    Links
    http://developer.yahoo.com/yui/3/
    http://developer.yahoo.com/yui/3/api/
    http://developer.yahoo.com/yui/theater/
    http://www.yuilibrary.com/
Wednesday, June 8, 2011

Mais conteúdo relacionado

Mais procurados

Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍louieuser
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UIRebecca Murphey
 
Web Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for PerformanceWeb Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for Performancejohndaviddalton
 
Idiots guide to jquery
Idiots guide to jqueryIdiots guide to jquery
Idiots guide to jqueryMark Casias
 
JQuery New Evolution
JQuery New EvolutionJQuery New Evolution
JQuery New EvolutionAllan Huang
 
The Ring programming language version 1.5.4 book - Part 60 of 185
The Ring programming language version 1.5.4 book - Part 60 of 185The Ring programming language version 1.5.4 book - Part 60 of 185
The Ring programming language version 1.5.4 book - Part 60 of 185Mahmoud Samir Fayed
 
Working effectively with ViewModels and TDD - UA Mobile 2019
Working effectively with ViewModels and TDD - UA Mobile 2019Working effectively with ViewModels and TDD - UA Mobile 2019
Working effectively with ViewModels and TDD - UA Mobile 2019UA Mobile
 
The Ring programming language version 1.8 book - Part 74 of 202
The Ring programming language version 1.8 book - Part 74 of 202The Ring programming language version 1.8 book - Part 74 of 202
The Ring programming language version 1.8 book - Part 74 of 202Mahmoud Samir Fayed
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3Simon Su
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScriptAndrew Dupont
 
Fabric.js @ Falsy Values
Fabric.js @ Falsy ValuesFabric.js @ Falsy Values
Fabric.js @ Falsy ValuesJuriy Zaytsev
 
Building a Pluggable Plugin
Building a Pluggable PluginBuilding a Pluggable Plugin
Building a Pluggable PluginBrandon Dove
 
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019Codemotion
 
The Ring programming language version 1.5.3 book - Part 78 of 184
The Ring programming language version 1.5.3 book - Part 78 of 184The Ring programming language version 1.5.3 book - Part 78 of 184
The Ring programming language version 1.5.3 book - Part 78 of 184Mahmoud Samir Fayed
 
Creating Ext GWT Extensions and Components
Creating Ext GWT Extensions and ComponentsCreating Ext GWT Extensions and Components
Creating Ext GWT Extensions and ComponentsSencha
 

Mais procurados (20)

Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
 
Xquery
XqueryXquery
Xquery
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UI
 
Web Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for PerformanceWeb Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for Performance
 
Idiots guide to jquery
Idiots guide to jqueryIdiots guide to jquery
Idiots guide to jquery
 
JQuery New Evolution
JQuery New EvolutionJQuery New Evolution
JQuery New Evolution
 
HTML,CSS Next
HTML,CSS NextHTML,CSS Next
HTML,CSS Next
 
【Unity】Scriptable object 入門と活用例
【Unity】Scriptable object 入門と活用例【Unity】Scriptable object 入門と活用例
【Unity】Scriptable object 入門と活用例
 
The Ring programming language version 1.5.4 book - Part 60 of 185
The Ring programming language version 1.5.4 book - Part 60 of 185The Ring programming language version 1.5.4 book - Part 60 of 185
The Ring programming language version 1.5.4 book - Part 60 of 185
 
Working effectively with ViewModels and TDD - UA Mobile 2019
Working effectively with ViewModels and TDD - UA Mobile 2019Working effectively with ViewModels and TDD - UA Mobile 2019
Working effectively with ViewModels and TDD - UA Mobile 2019
 
The Ring programming language version 1.8 book - Part 74 of 202
The Ring programming language version 1.8 book - Part 74 of 202The Ring programming language version 1.8 book - Part 74 of 202
The Ring programming language version 1.8 book - Part 74 of 202
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
Fabric.js @ Falsy Values
Fabric.js @ Falsy ValuesFabric.js @ Falsy Values
Fabric.js @ Falsy Values
 
Building a Pluggable Plugin
Building a Pluggable PluginBuilding a Pluggable Plugin
Building a Pluggable Plugin
 
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
 
The Ring programming language version 1.5.3 book - Part 78 of 184
The Ring programming language version 1.5.3 book - Part 78 of 184The Ring programming language version 1.5.3 book - Part 78 of 184
The Ring programming language version 1.5.3 book - Part 78 of 184
 
Phactory
PhactoryPhactory
Phactory
 
Creating Ext GWT Extensions and Components
Creating Ext GWT Extensions and ComponentsCreating Ext GWT Extensions and Components
Creating Ext GWT Extensions and Components
 
New text document
New text documentNew text document
New text document
 

Destaque

Exposicion sobre los Derechos Humanos UNEFA
Exposicion sobre los Derechos Humanos UNEFAExposicion sobre los Derechos Humanos UNEFA
Exposicion sobre los Derechos Humanos UNEFAJose Gil
 
Titulos propuestos del plan de la patria 2015
Titulos propuestos del plan de la patria 2015Titulos propuestos del plan de la patria 2015
Titulos propuestos del plan de la patria 2015UNEFA MARACAY
 
Defensas (derechos humanos en venezuela)
Defensas (derechos humanos en venezuela)Defensas (derechos humanos en venezuela)
Defensas (derechos humanos en venezuela)Jose Gil
 
Antecedentes de los derechos humanos
Antecedentes de los derechos humanosAntecedentes de los derechos humanos
Antecedentes de los derechos humanosCECILIA MOTTA ZARARTE
 
Tema 4. Sistemas de protección de los Derechos HUmanos
Tema 4. Sistemas de protección de los Derechos HUmanos Tema 4. Sistemas de protección de los Derechos HUmanos
Tema 4. Sistemas de protección de los Derechos HUmanos Fmorin84
 
Plan de gobierno 2013 2019
Plan de gobierno 2013 2019Plan de gobierno 2013 2019
Plan de gobierno 2013 20193230594
 
Derechos humanos en venezuela
Derechos humanos en venezuelaDerechos humanos en venezuela
Derechos humanos en venezuelaAngello Ferrari
 
Derechos humanos
Derechos humanosDerechos humanos
Derechos humanosKAtiRojChu
 

Destaque (8)

Exposicion sobre los Derechos Humanos UNEFA
Exposicion sobre los Derechos Humanos UNEFAExposicion sobre los Derechos Humanos UNEFA
Exposicion sobre los Derechos Humanos UNEFA
 
Titulos propuestos del plan de la patria 2015
Titulos propuestos del plan de la patria 2015Titulos propuestos del plan de la patria 2015
Titulos propuestos del plan de la patria 2015
 
Defensas (derechos humanos en venezuela)
Defensas (derechos humanos en venezuela)Defensas (derechos humanos en venezuela)
Defensas (derechos humanos en venezuela)
 
Antecedentes de los derechos humanos
Antecedentes de los derechos humanosAntecedentes de los derechos humanos
Antecedentes de los derechos humanos
 
Tema 4. Sistemas de protección de los Derechos HUmanos
Tema 4. Sistemas de protección de los Derechos HUmanos Tema 4. Sistemas de protección de los Derechos HUmanos
Tema 4. Sistemas de protección de los Derechos HUmanos
 
Plan de gobierno 2013 2019
Plan de gobierno 2013 2019Plan de gobierno 2013 2019
Plan de gobierno 2013 2019
 
Derechos humanos en venezuela
Derechos humanos en venezuelaDerechos humanos en venezuela
Derechos humanos en venezuela
 
Derechos humanos
Derechos humanosDerechos humanos
Derechos humanos
 

Semelhante a YUI3 Modules

Get started with YUI
Get started with YUIGet started with YUI
Get started with YUIAdam Lu
 
Node conf - building realtime webapps
Node conf - building realtime webappsNode conf - building realtime webapps
Node conf - building realtime webappsHenrik Joreteg
 
Embracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend PerfEmbracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend PerfMorgan Cheng
 
Programação GUI com jRuby
Programação GUI com jRubyProgramação GUI com jRuby
Programação GUI com jRubyFrevo on Rails
 
Jquery plugin development
Jquery plugin developmentJquery plugin development
Jquery plugin developmentFaruk Hossen
 
2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui2009 Hackday Taiwan Yui
2009 Hackday Taiwan YuiJH Lee
 
Javascript essential-pattern
Javascript essential-patternJavascript essential-pattern
Javascript essential-pattern偉格 高
 
Android Architecture Components
Android Architecture ComponentsAndroid Architecture Components
Android Architecture ComponentsBurhanuddinRashid
 
Super Awesome Interactions with jQuery
Super Awesome Interactions with jQuerySuper Awesome Interactions with jQuery
Super Awesome Interactions with jQueryZURB
 
Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4jeresig
 
jQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journeyjQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journeyHuiyi Yan
 
Backbone intro
Backbone introBackbone intro
Backbone introIan Yang
 
Android Opensources - ButterKnife, Lombok
Android Opensources - ButterKnife, LombokAndroid Opensources - ButterKnife, Lombok
Android Opensources - ButterKnife, LombokWooseong Kim
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testingjeresig
 
Magento Imagine eCommerce Conference - February 2011 - Unit Testing with Magento
Magento Imagine eCommerce Conference - February 2011 - Unit Testing with MagentoMagento Imagine eCommerce Conference - February 2011 - Unit Testing with Magento
Magento Imagine eCommerce Conference - February 2011 - Unit Testing with Magentovarien
 
Magento's Imagine eCommerce Conference 2011 - Unit Testing with Magento
Magento's Imagine eCommerce Conference 2011 - Unit Testing with MagentoMagento's Imagine eCommerce Conference 2011 - Unit Testing with Magento
Magento's Imagine eCommerce Conference 2011 - Unit Testing with MagentoMagentoImagine
 
2011 july-nyc-gtug-go
2011 july-nyc-gtug-go2011 july-nyc-gtug-go
2011 july-nyc-gtug-goikailan
 

Semelhante a YUI3 Modules (20)

Testable Javascript
Testable JavascriptTestable Javascript
Testable Javascript
 
Get started with YUI
Get started with YUIGet started with YUI
Get started with YUI
 
Node conf - building realtime webapps
Node conf - building realtime webappsNode conf - building realtime webapps
Node conf - building realtime webapps
 
Embracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend PerfEmbracing YUI3 and Frontend Perf
Embracing YUI3 and Frontend Perf
 
Programação GUI com jRuby
Programação GUI com jRubyProgramação GUI com jRuby
Programação GUI com jRuby
 
Jquery plugin development
Jquery plugin developmentJquery plugin development
Jquery plugin development
 
2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui2009 Hackday Taiwan Yui
2009 Hackday Taiwan Yui
 
Javascript essential-pattern
Javascript essential-patternJavascript essential-pattern
Javascript essential-pattern
 
Android Architecture Components
Android Architecture ComponentsAndroid Architecture Components
Android Architecture Components
 
Super Awesome Interactions with jQuery
Super Awesome Interactions with jQuerySuper Awesome Interactions with jQuery
Super Awesome Interactions with jQuery
 
Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4
 
jQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journeyjQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journey
 
Backbone intro
Backbone introBackbone intro
Backbone intro
 
Android Opensources - ButterKnife, Lombok
Android Opensources - ButterKnife, LombokAndroid Opensources - ButterKnife, Lombok
Android Opensources - ButterKnife, Lombok
 
Essential YUI
Essential YUIEssential YUI
Essential YUI
 
Slide
SlideSlide
Slide
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
 
Magento Imagine eCommerce Conference - February 2011 - Unit Testing with Magento
Magento Imagine eCommerce Conference - February 2011 - Unit Testing with MagentoMagento Imagine eCommerce Conference - February 2011 - Unit Testing with Magento
Magento Imagine eCommerce Conference - February 2011 - Unit Testing with Magento
 
Magento's Imagine eCommerce Conference 2011 - Unit Testing with Magento
Magento's Imagine eCommerce Conference 2011 - Unit Testing with MagentoMagento's Imagine eCommerce Conference 2011 - Unit Testing with Magento
Magento's Imagine eCommerce Conference 2011 - Unit Testing with Magento
 
2011 july-nyc-gtug-go
2011 july-nyc-gtug-go2011 july-nyc-gtug-go
2011 july-nyc-gtug-go
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
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
 
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 FMESafe Software
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
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.pptxRustici Software
 
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...DianaGray10
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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
 
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...Jeffrey Haguewood
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Último (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
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...
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
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...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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...
 
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...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

YUI3 Modules

  • 1. YUI3 : MODULES Base - Plugin - Widget Wednesday, June 8, 2011
  • 3. CLASS OBJECTS Constructor Functions function wooga() {} var wooga = function(){}; Wednesday, June 8, 2011
  • 4. PROPERTIES function Fooga() { this.wooga = 'wooga'; } Fooga.PI = Math.PI; Fooga.prototype.nooga = function(){ return 42; }; Wednesday, June 8, 2011
  • 5. EXTENDING function Fooga() { Y.log('Fooga constructor'); } function Hooga() { Y.log('Hooga constructor'); Hooga.superclass.constructor.apply(this, arguments); } Y.extend(Hooga, Fooga); Wednesday, June 8, 2011
  • 6. MIXING function Hooga() {} Hooga.prototype.fooga = 'wooga'; function Nooga() {} Nooga.prototype.fooga = null; Y.mix(Hooga, Nooga); var h = new Hooga(); Y.log(h.fooga); // 'wooga' Y.mix(Hooga, Nooga, true, null, 2); // allow override. set mode to prototype (2) var h2 = new Hooga(); Y.log(h2.fooga); // null Wednesday, June 8, 2011
  • 7. EXAMPLE function Fooga() { Fooga.superclass.constructor.apply(this, arguments); } Fooga.NAME = 'fooga'; Fooga.ATTRS = { timer : { value : 2000 } }; Y.extend(Fooga, Y.Base); Y.mix(Fooga, Y.io); Wednesday, June 8, 2011
  • 9. UNDER THE HOOD • Event Target - publish(), fire(), once(), before(), on(), after() • Attribute - set(), get(), value, valueFn, setter, getter, validator, readOnly, writeOnce • Plugin Host - plug(), unplug(), hasPlugin() Wednesday, June 8, 2011
  • 10. METHODS • Static - create(), mix(), plug(), unplug() • Life Cycle - init(), destroy() Wednesday, June 8, 2011
  • 11. EVENTS AND CONFIG • Configuration - initialize, destroyed • Events - init, initializedChange, destroy, destroyedChange Wednesday, June 8, 2011
  • 12. EXAMPLE YUI.add('calc', function(Y){ Y.Calc = Y.Base.create('calc', Y.Base, [], { add : function() { var total = this.get('total'), args = arguments; Y.Array.each(args, function(val) { total += parseFloat(val, 10); }); this.set('total', total); return total; } }, { ATTRS : { total : { value : 0 } } }); }, '1.0.0', { requires: ['base'] }); Wednesday, June 8, 2011
  • 14. LIFE CYCLE • initializer - fired on plug() • destructor - fired on unplug() Wednesday, June 8, 2011
  • 15. METHODS • Life Cycle - initializer(), destructor() • Host Method - beforeHostMethod(), afterHostMethod() • Host Event - onHostEvent(), afterHostEvent() Wednesday, June 8, 2011
  • 16. EVENTS AND CONFIG • host - object that gets plugged • hostChange - fires when the host has changed Wednesday, June 8, 2011
  • 17. EXAMPLE YUI.add('my-plugin', function(Y){ Y.Plugin.MyPlugin = Y.Base.create('my-plugin', Y.Plugin.Base, [], { _clickHandle : null, initializer : function() { this._bindUI(); }, destructor : function() { var handle = this._clickHandle; if (handle) { handle.detach(); } }, _bindUI : function() { this._clickHandle = this.get('host').on('click', this._preventClick, this); }, _preventClick : function(e) { e.preventDefault(); Y.log('click prevented'); } }, { NS : 'my-plugin', ATTRS : {} }); }, '1.0.0', { requires: ['plugin', 'base-build'] }); Wednesday, June 8, 2011
  • 19. LIFE CYCLE • initializer • render • renderUI • bindUI • syncUI • destructor Wednesday, June 8, 2011
  • 20. METHODS • focus - blur(), focus() • enable - enable(), disable() • show - show(), hide() • getClassName() • getSkinName() Wednesday, June 8, 2011
  • 21. EVENTS AND CONFIG • boundingBox • boundingBoxChange • contentBox • contentBoxChange • srcNode • srcNodeChange • tabIndex • tabIndexChange • rendered • renderedChange • visible • visibleChange Wednesday, June 8, 2011
  • 22. EXAMPLE YUI.add('my-widget', function(Y){ Y.MyWidget = Y.Base.create('my-widget', Y.Widget, [], { renderUI : function() { var cb = this.get('contentBox'); cb.append(Y.Node.create('<strong />')); cb.one('strong').setContent(this.get('content')); }, bindUI : function() { var strongNode = this.get('contentBox').one('strong'); strongNode.on('click', function(e){ e.currentTarget.toggleClass('blue'); }); } }, { ATTRS : { content : { value : 'Widget Content' } } }); }, '1.0.0', { requires: ['widget', 'base-build'] }); Wednesday, June 8, 2011
  • 23. PLUGIN OR EXTENSION • Plug when you: • Extend when you: • Want to add or remove • Want to keep the features during run time functionality across all instances • Want to mix features per instance • Want to mix features into a new object Wednesday, June 8, 2011
  • 24. QUESTIONS? Anthony Pipkin @apipkin IRC: apipkin meebo: a.pipkin Links http://developer.yahoo.com/yui/3/ http://developer.yahoo.com/yui/3/api/ http://developer.yahoo.com/yui/theater/ http://www.yuilibrary.com/ Wednesday, June 8, 2011