SlideShare ist ein Scribd-Unternehmen logo
1 von 25
YUI! E l'App Framewok:
l'MVC secondo Yahoo!
Lucio Grenzi

l.grenzi@gmail.com
Who am I?
• Delphi developer for 11 years
• Now freelance and Asp.net developer
• Javascript addicted
    Nonantolando.blogspot.com
   https://plus.google.com/108943068354277861330
   http://it.linkedin.com/pub/lucio-grenzi/27/2bb/2a

                                                      Lucio Grenzi   2
                                    l.grenzi@gmail.com – Freelance
Who am I?
• Delphi developer for 11 years
• Now freelance and Asp.net developer
• Javascript addicted
    Nonantolando.blogspot.com
   https://plus.google.com/108943068354277861330
   http://it.linkedin.com/pub/lucio-grenzi/27/2bb/2a

                                                      Lucio Grenzi   3
                                    l.grenzi@gmail.com – Freelance
Agenda
•   Brief introduction Yui
•   What's new on Yui 3.4.x
•   How App framework works
•   What's expected on Yui 3.5



                                                   Lucio Grenzi   4
                                 l.grenzi@gmail.com – Freelance
YUI is a free, open source JavaScript and CSS
    framework for building richly interactive web
                    applications.
• Fast
• Complete
• Industrial Strength
• Free & Open
                                                  Lucio Grenzi   5
                                l.grenzi@gmail.com – Freelance
One more javascript framework?
•   jQuery
•   ExtJS
•   Dojo
•   Yui
•   …..


                                               Lucio Grenzi   6
                             l.grenzi@gmail.com – Freelance
What's new on Yui 3.4
• The new Calendar component is now included in the build. This is a very
  early release consisting of Calendar’s core functionality. Skinning and
  additional features will continue to be added ahead of the 3.4.0 launch.
• The App Framework, YUI’s new suite of MVC infrastructure components, is
  fully functional and ready for use.
• ScrollView now supports vertical paging, includes a scrollview-list plugin to
  add CSS classnames to immediate list elements, as well several bug fixes
  and refactoring
• You will also find updates to the Graphics API, performance enhancements
  in Base, bug fixes in Dial, and many more additions throughout the library.


                                                                      Lucio Grenzi   7
                                                    l.grenzi@gmail.com – Freelance
Yui App framework = jQuery + Backbone.js ?
• The YUI 3 app framework is heavily inspired by
  Backbone.js.
• App framework is tightly integrated on the
  framework and takes advantage of YUI's
  fantastic custom event system and extensible
  component infrastructure


                                                 Lucio Grenzi   8
                               l.grenzi@gmail.com – Freelance
Yui App framework blocks
•   Model
•   Model list
•   View
•   Controller



                                                Lucio Grenzi   9
                              l.grenzi@gmail.com – Freelance
Model
is a lightweight Attribute-based data model with
  methods for getting, setting, validating, and
  syncing attribute values to a persistence layer
  or server, as well as events for notifying
  listeners of model changes.



                                                   Lucio Grenzi   10
                                 l.grenzi@gmail.com – Freelance
Model list
is an array-like ordered list of Model instances
  with methods for adding, removing, sorting,
  filtering, and performing other actions on
  models in the list.
All events fired by a model automatically bubble
  up to all the lists that contain that model, so
  lists serve as convenient aggregators for model
  events.
                                                  Lucio Grenzi   11
                                l.grenzi@gmail.com – Freelance
View
represents a renderable piece of an application's
  user interface, and provides hooks for easily
  subscribing to and handling delegated DOM
  events on a view's container element.




                                                  Lucio Grenzi   12
                                l.grenzi@gmail.com – Freelance
Controller
provides URL-based same-page routing using
  HTML5 history (pushState) or the location
  hash, depending on what the user's browser
  supports.




                                                 Lucio Grenzi   13
                               l.grenzi@gmail.com – Freelance
Todo Model
TodoModel = Y.TodoModel = Y.Base.create('todoModel', Y.Model, [], {
  sync: LocalStorageSync('todo'),

    toggleDone: function () {
       this.set('done', !this.get('done')).save();
    }
}, {
    ATTRS: {
       done: {value: false},
       text: {value: ''}
    }
});
                                                                          Lucio Grenzi   14
                                                        l.grenzi@gmail.com – Freelance
ToDo List
TodoList = Y.TodoList = Y.Base.create('todoList', Y.ModelList, [], {
  model: TodoModel,
  sync : LocalStorageSync('todo'),

  done: function () {
     return Y.Array.filter(this.toArray(), function (model) {
         return model.get('done');
     });
  },

  remaining: function () {
     return Y.Array.filter(this.toArray(), function (model) {
         return !model.get('done');
     });
  }});

                                                                                         Lucio Grenzi   15
                                                                       l.grenzi@gmail.com – Freelance
TodoAppView (1/2)
TodoAppView = Y.TodoAppView = Y.Base.create('todoAppView', Y.View, [], {
  container: Y.one('#todo-app'),
  inputNode: Y.one('#new-todo'),
  template: Y.one('#todo-stats-template').getContent(),


  events: {
      '#new-todo': {keypress: 'createTodo'},
      '.todo-clear': {click: 'clearDone'},
      '.todo-item': {
          mouseover: 'hoverOn',
          mouseout : 'hoverOff'
      }
  }
                                                                                         Lucio Grenzi   16
                                                                       l.grenzi@gmail.com – Freelance
TodoAppView (2/2)
initializer: function () {
   var list = this.todoList = new TodoList();
   list.after('add', this.add, this);
   list.after('reset', this.reset, this);
   list.after(['add', 'reset', 'remove', 'todoModel:doneChange'], this.render, this); list.load(); },


render: function () {
   var todoList = this.todoList,
      stats    = this.container.one('#todo-stats'),
      numRemaining, numDone;


   if (todoList.isEmpty()) { stats.empty(); return this; }
   numDone         = todoList.done().length;
   numRemaining = todoList.remaining().length;
                                                                                                       Lucio Grenzi   17
                                                                                     l.grenzi@gmail.com – Freelance
TodoView (1/2)
TodoView = Y.TodoView = Y.Base.create('todoView', Y.View, [], {
  container: '<li class="todo-item"/>',
  template: Y.one('#todo-item-template').getContent(),
  events: {
      '.todo-checkbox': {click: 'toggleDone'},
      '.todo-content': {
           click: 'edit',
           focus: 'edit'
      },
      '.todo-input' : {
           blur    : 'save',
           keypress: 'enter'
      },
      '.todo-remove': {click: 'remove'}
  }
                                                                                    Lucio Grenzi   18
                                                                  l.grenzi@gmail.com – Freelance
TodoView (2/2)
edit: function () {
   this.container.addClass('editing');
   this.inputNode.focus();    },
enter: function (e) {
   if (e.keyCode === 13) { // enter key
       Y.one('#new-todo').focus();
   }   },
remove: function (e) {
   e.preventDefault();
   this.constructor.superclass.remove.call(this);
   this.model.destroy({'delete': true});   },
save: function () {
   this.container.removeClass('editing');
   this.model.set('text', this.inputNode.get('value')).save();   },
toggleDone: function () {    this.model.toggleDone();      }
                                                                                        Lucio Grenzi   19
                                                                      l.grenzi@gmail.com – Freelance
LocalStorageSync (1/2)
function LocalStorageSync(key) {
  var localStorage;
  if (!key) { Y.error('No storage key specified.'); }
  if (Y.config.win.localStorage) { localStorage = Y.config.win.localStorage;}
  var data = Y.JSON.parse((localStorage && localStorage.getItem(key)) || '{}');
  function destroy(id) {
      var modelHash;
      if ((modelHash = data[id])) {
          delete data[id];
          save();
      }
      return modelHash;
  }
                                                                                                  Lucio Grenzi   20
                                                                                l.grenzi@gmail.com – Freelance
LocalStorageSync (2/2)
return function (action, options, callback) {
   var isModel = Y.Model && this instanceof Y.Model;


   switch (action) {
   case 'create': // intentional fallthru
   case 'update': callback(null, set(this));
      return;


   case 'read': callback(null, get(isModel && this.get('id')));
      return;


   case 'delete': callback(null, destroy(isModel && this.get('id')));
      return;
   } };
                                                                                          Lucio Grenzi   21
                                                                        l.grenzi@gmail.com – Freelance
What's next? (3.5.0)
•   Y.Controller is now Y.Router
•   New route handler signature
•   Some properties are now attributes
•   Documentation updated



                                                   Lucio Grenzi   22
                                 l.grenzi@gmail.com – Freelance
References
•   http://yuilibrary.com/projects/yui3/
•   https://github.com/yui/yui3
•   http://yuilibrary.com/yui/docs/app/app-todo.html
•   http://www.yuiblog.com/blog/2011/12/12/app-framework-350/




                                                            Lucio Grenzi   23
                                          l.grenzi@gmail.com – Freelance
Questions?




                               Lucio Grenzi   24
             l.grenzi@gmail.com – Freelance
Thank you




Creative Commons via tcmaker.org



                                                     Lucio Grenzi   25
                                   l.grenzi@gmail.com – Freelance

Weitere ähnliche Inhalte

Ähnlich wie Yui app-framework

From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)Jose Manuel Pereira Garcia
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQueryAnil Kumar
 
Reactive Programming with JavaScript
Reactive Programming with JavaScriptReactive Programming with JavaScript
Reactive Programming with JavaScriptCodemotion
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAERon Reiter
 
A Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETA Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETJames Johnson
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterpriseDave Artz
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactOliver N
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to DjangoJoaquim Rocha
 
Quick Intro to Android Development
Quick Intro to Android DevelopmentQuick Intro to Android Development
Quick Intro to Android DevelopmentJussi Pohjolainen
 
A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperManoj Bhuva
 
How to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in ScilabHow to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in ScilabScilab
 
Lhy tutorial gui(1)
Lhy tutorial gui(1)Lhy tutorial gui(1)
Lhy tutorial gui(1)Brijesh Naik
 
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...jpalley
 
A Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETA Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETJames Johnson
 

Ähnlich wie Yui app-framework (20)

From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
Reactive Programming with JavaScript
Reactive Programming with JavaScriptReactive Programming with JavaScript
Reactive Programming with JavaScript
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAE
 
Jquery library
Jquery libraryJquery library
Jquery library
 
Django introduction
Django introductionDjango introduction
Django introduction
 
Jquery
JqueryJquery
Jquery
 
A Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETA Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NET
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose React
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
J query training
J query trainingJ query training
J query training
 
Quick Intro to Android Development
Quick Intro to Android DevelopmentQuick Intro to Android Development
Quick Intro to Android Development
 
A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java Developer
 
How to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in ScilabHow to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in Scilab
 
Lhy tutorial gui(1)
Lhy tutorial gui(1)Lhy tutorial gui(1)
Lhy tutorial gui(1)
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
RailsConf 2010: From 1 to 30 - How to refactor one monolithic application int...
 
A Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETA Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NET
 

Mehr von Lucio Grenzi

How to use Postgresql in order to handle Prometheus metrics storage
How to use Postgresql in order to handle Prometheus metrics storageHow to use Postgresql in order to handle Prometheus metrics storage
How to use Postgresql in order to handle Prometheus metrics storageLucio Grenzi
 
Building serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platformBuilding serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platformLucio Grenzi
 
Patroni: PostgreSQL HA in the cloud
Patroni: PostgreSQL HA in the cloudPatroni: PostgreSQL HA in the cloud
Patroni: PostgreSQL HA in the cloudLucio Grenzi
 
Postgrest: the REST API for PostgreSQL databases
Postgrest: the REST API for PostgreSQL databasesPostgrest: the REST API for PostgreSQL databases
Postgrest: the REST API for PostgreSQL databasesLucio Grenzi
 
Use Ionic Framework to develop mobile application
Use Ionic Framework to develop mobile applicationUse Ionic Framework to develop mobile application
Use Ionic Framework to develop mobile applicationLucio Grenzi
 
Rabbitmq & Postgresql
Rabbitmq & PostgresqlRabbitmq & Postgresql
Rabbitmq & PostgresqlLucio Grenzi
 
Jenkins djangovillage
Jenkins djangovillageJenkins djangovillage
Jenkins djangovillageLucio Grenzi
 
Geodjango and HTML 5
Geodjango and HTML 5Geodjango and HTML 5
Geodjango and HTML 5Lucio Grenzi
 
PLV8 - The PostgreSQL web side
PLV8 - The PostgreSQL web sidePLV8 - The PostgreSQL web side
PLV8 - The PostgreSQL web sideLucio Grenzi
 

Mehr von Lucio Grenzi (12)

How to use Postgresql in order to handle Prometheus metrics storage
How to use Postgresql in order to handle Prometheus metrics storageHow to use Postgresql in order to handle Prometheus metrics storage
How to use Postgresql in order to handle Prometheus metrics storage
 
Building serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platformBuilding serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platform
 
Patroni: PostgreSQL HA in the cloud
Patroni: PostgreSQL HA in the cloudPatroni: PostgreSQL HA in the cloud
Patroni: PostgreSQL HA in the cloud
 
Postgrest: the REST API for PostgreSQL databases
Postgrest: the REST API for PostgreSQL databasesPostgrest: the REST API for PostgreSQL databases
Postgrest: the REST API for PostgreSQL databases
 
Full slidescr16
Full slidescr16Full slidescr16
Full slidescr16
 
Use Ionic Framework to develop mobile application
Use Ionic Framework to develop mobile applicationUse Ionic Framework to develop mobile application
Use Ionic Framework to develop mobile application
 
Rabbitmq & Postgresql
Rabbitmq & PostgresqlRabbitmq & Postgresql
Rabbitmq & Postgresql
 
Jenkins djangovillage
Jenkins djangovillageJenkins djangovillage
Jenkins djangovillage
 
Geodjango and HTML 5
Geodjango and HTML 5Geodjango and HTML 5
Geodjango and HTML 5
 
PLV8 - The PostgreSQL web side
PLV8 - The PostgreSQL web sidePLV8 - The PostgreSQL web side
PLV8 - The PostgreSQL web side
 
Pg tap
Pg tapPg tap
Pg tap
 
Geodjango
GeodjangoGeodjango
Geodjango
 

Kürzlich hochgeladen

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
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
 
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
 
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
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Kürzlich hochgeladen (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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
 
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...
 
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
 
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...
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

Yui app-framework

  • 1. YUI! E l'App Framewok: l'MVC secondo Yahoo! Lucio Grenzi l.grenzi@gmail.com
  • 2. Who am I? • Delphi developer for 11 years • Now freelance and Asp.net developer • Javascript addicted Nonantolando.blogspot.com https://plus.google.com/108943068354277861330 http://it.linkedin.com/pub/lucio-grenzi/27/2bb/2a Lucio Grenzi 2 l.grenzi@gmail.com – Freelance
  • 3. Who am I? • Delphi developer for 11 years • Now freelance and Asp.net developer • Javascript addicted Nonantolando.blogspot.com https://plus.google.com/108943068354277861330 http://it.linkedin.com/pub/lucio-grenzi/27/2bb/2a Lucio Grenzi 3 l.grenzi@gmail.com – Freelance
  • 4. Agenda • Brief introduction Yui • What's new on Yui 3.4.x • How App framework works • What's expected on Yui 3.5 Lucio Grenzi 4 l.grenzi@gmail.com – Freelance
  • 5. YUI is a free, open source JavaScript and CSS framework for building richly interactive web applications. • Fast • Complete • Industrial Strength • Free & Open Lucio Grenzi 5 l.grenzi@gmail.com – Freelance
  • 6. One more javascript framework? • jQuery • ExtJS • Dojo • Yui • ….. Lucio Grenzi 6 l.grenzi@gmail.com – Freelance
  • 7. What's new on Yui 3.4 • The new Calendar component is now included in the build. This is a very early release consisting of Calendar’s core functionality. Skinning and additional features will continue to be added ahead of the 3.4.0 launch. • The App Framework, YUI’s new suite of MVC infrastructure components, is fully functional and ready for use. • ScrollView now supports vertical paging, includes a scrollview-list plugin to add CSS classnames to immediate list elements, as well several bug fixes and refactoring • You will also find updates to the Graphics API, performance enhancements in Base, bug fixes in Dial, and many more additions throughout the library. Lucio Grenzi 7 l.grenzi@gmail.com – Freelance
  • 8. Yui App framework = jQuery + Backbone.js ? • The YUI 3 app framework is heavily inspired by Backbone.js. • App framework is tightly integrated on the framework and takes advantage of YUI's fantastic custom event system and extensible component infrastructure Lucio Grenzi 8 l.grenzi@gmail.com – Freelance
  • 9. Yui App framework blocks • Model • Model list • View • Controller Lucio Grenzi 9 l.grenzi@gmail.com – Freelance
  • 10. Model is a lightweight Attribute-based data model with methods for getting, setting, validating, and syncing attribute values to a persistence layer or server, as well as events for notifying listeners of model changes. Lucio Grenzi 10 l.grenzi@gmail.com – Freelance
  • 11. Model list is an array-like ordered list of Model instances with methods for adding, removing, sorting, filtering, and performing other actions on models in the list. All events fired by a model automatically bubble up to all the lists that contain that model, so lists serve as convenient aggregators for model events. Lucio Grenzi 11 l.grenzi@gmail.com – Freelance
  • 12. View represents a renderable piece of an application's user interface, and provides hooks for easily subscribing to and handling delegated DOM events on a view's container element. Lucio Grenzi 12 l.grenzi@gmail.com – Freelance
  • 13. Controller provides URL-based same-page routing using HTML5 history (pushState) or the location hash, depending on what the user's browser supports. Lucio Grenzi 13 l.grenzi@gmail.com – Freelance
  • 14. Todo Model TodoModel = Y.TodoModel = Y.Base.create('todoModel', Y.Model, [], { sync: LocalStorageSync('todo'), toggleDone: function () { this.set('done', !this.get('done')).save(); } }, { ATTRS: { done: {value: false}, text: {value: ''} } }); Lucio Grenzi 14 l.grenzi@gmail.com – Freelance
  • 15. ToDo List TodoList = Y.TodoList = Y.Base.create('todoList', Y.ModelList, [], { model: TodoModel, sync : LocalStorageSync('todo'), done: function () { return Y.Array.filter(this.toArray(), function (model) { return model.get('done'); }); }, remaining: function () { return Y.Array.filter(this.toArray(), function (model) { return !model.get('done'); }); }}); Lucio Grenzi 15 l.grenzi@gmail.com – Freelance
  • 16. TodoAppView (1/2) TodoAppView = Y.TodoAppView = Y.Base.create('todoAppView', Y.View, [], { container: Y.one('#todo-app'), inputNode: Y.one('#new-todo'), template: Y.one('#todo-stats-template').getContent(), events: { '#new-todo': {keypress: 'createTodo'}, '.todo-clear': {click: 'clearDone'}, '.todo-item': { mouseover: 'hoverOn', mouseout : 'hoverOff' } } Lucio Grenzi 16 l.grenzi@gmail.com – Freelance
  • 17. TodoAppView (2/2) initializer: function () { var list = this.todoList = new TodoList(); list.after('add', this.add, this); list.after('reset', this.reset, this); list.after(['add', 'reset', 'remove', 'todoModel:doneChange'], this.render, this); list.load(); }, render: function () { var todoList = this.todoList, stats = this.container.one('#todo-stats'), numRemaining, numDone; if (todoList.isEmpty()) { stats.empty(); return this; } numDone = todoList.done().length; numRemaining = todoList.remaining().length; Lucio Grenzi 17 l.grenzi@gmail.com – Freelance
  • 18. TodoView (1/2) TodoView = Y.TodoView = Y.Base.create('todoView', Y.View, [], { container: '<li class="todo-item"/>', template: Y.one('#todo-item-template').getContent(), events: { '.todo-checkbox': {click: 'toggleDone'}, '.todo-content': { click: 'edit', focus: 'edit' }, '.todo-input' : { blur : 'save', keypress: 'enter' }, '.todo-remove': {click: 'remove'} } Lucio Grenzi 18 l.grenzi@gmail.com – Freelance
  • 19. TodoView (2/2) edit: function () { this.container.addClass('editing'); this.inputNode.focus(); }, enter: function (e) { if (e.keyCode === 13) { // enter key Y.one('#new-todo').focus(); } }, remove: function (e) { e.preventDefault(); this.constructor.superclass.remove.call(this); this.model.destroy({'delete': true}); }, save: function () { this.container.removeClass('editing'); this.model.set('text', this.inputNode.get('value')).save(); }, toggleDone: function () { this.model.toggleDone(); } Lucio Grenzi 19 l.grenzi@gmail.com – Freelance
  • 20. LocalStorageSync (1/2) function LocalStorageSync(key) { var localStorage; if (!key) { Y.error('No storage key specified.'); } if (Y.config.win.localStorage) { localStorage = Y.config.win.localStorage;} var data = Y.JSON.parse((localStorage && localStorage.getItem(key)) || '{}'); function destroy(id) { var modelHash; if ((modelHash = data[id])) { delete data[id]; save(); } return modelHash; } Lucio Grenzi 20 l.grenzi@gmail.com – Freelance
  • 21. LocalStorageSync (2/2) return function (action, options, callback) { var isModel = Y.Model && this instanceof Y.Model; switch (action) { case 'create': // intentional fallthru case 'update': callback(null, set(this)); return; case 'read': callback(null, get(isModel && this.get('id'))); return; case 'delete': callback(null, destroy(isModel && this.get('id'))); return; } }; Lucio Grenzi 21 l.grenzi@gmail.com – Freelance
  • 22. What's next? (3.5.0) • Y.Controller is now Y.Router • New route handler signature • Some properties are now attributes • Documentation updated Lucio Grenzi 22 l.grenzi@gmail.com – Freelance
  • 23. References • http://yuilibrary.com/projects/yui3/ • https://github.com/yui/yui3 • http://yuilibrary.com/yui/docs/app/app-todo.html • http://www.yuiblog.com/blog/2011/12/12/app-framework-350/ Lucio Grenzi 23 l.grenzi@gmail.com – Freelance
  • 24. Questions? Lucio Grenzi 24 l.grenzi@gmail.com – Freelance
  • 25. Thank you Creative Commons via tcmaker.org Lucio Grenzi 25 l.grenzi@gmail.com – Freelance