SlideShare ist ein Scribd-Unternehmen logo
1 von 76
Downloaden Sie, um offline zu lesen
YUI App Framework
  You’ve Been Wanting This



                     Eric Ferraiuolo
                              @ericf
MVC
Backbone
Model
Y.Model
• Manages data/state
• Observable attributes
• Coalesced change event
• Contains business logic
• Has data-syncing layer
Y.ModelList
          1   foo

          2   foo

          3   foo

set()     4   foo

          5   foo

          6   foo

          7   foo
Y.ModelList




                   }
        1    foo

        2    foo

        3    foo

set()   4    foo      foo:change
        5    foo

        6    foo

        7    foo
View
Y.View
• Containment
• Render-able (you provide rendering logic)
• BYO-Template
• Declarative event subscriptions
• Lightweight
Router
Y.Controller Y.Router
• Basic navigation management
• Uses HTML5 pushState & popstate
   • Degrades to hash-based history
• Bookmark-able URLs
• Browser back/forward buttons work!
• Wire-up application states to routes
Y.Router Example
var router = new Y.Router();

router.route('/library/:lib/', function (req) {
    var lib = req.params.lib;
    if (lib === 'yui') {
        Y.log('YUI Library is awesome!');
    }
});

router.save('/library/yui/');
// => 'YUI Library is awesome!'
Y.Router Example
var router = new Y.Router();

router.route('/library/:lib/', function (req) {
    var lib = req.params.lib;
    if (lib === 'yui') {
        Y.log('YUI Library is awesome!');
    }
});

router.save('/library/yui/');
// => 'YUI Library is awesome!'
Y.Router Example
var router = new Y.Router();

router.route('/library/:lib/', function (req) {
    var lib = req.params.lib;
    if (lib === 'yui') {
        Y.log('YUI Library is awesome!');
    }
});

router.save('/library/yui/');
// => 'YUI Library is awesome!'
Y.Router Example
var router = new Y.Router();

router.route('/library/:lib/', function (req) {
    var lib = req.params.lib;
    if (lib === 'yui') {
        Y.log('YUI Library is awesome!');
    }
});

router.save('/library/yui/');
// => 'YUI Library is awesome!'
Y.Router Example
var router = new Y.Router();

router.route('/library/:lib/', function (req) {
    var lib = req.params.lib;
    if (lib === 'yui') {
        Y.log('YUI Library is awesome!');
    }
});

router.save('/library/yui/');
// => 'YUI Library is awesome!'
Y.Router Example
var router = new Y.Router();

router.route('/library/:lib/', function (req) {
    var lib = req.params.lib;
    if (lib === 'yui') {
        Y.log('YUI Library is awesome!');
    }
});

router.save('/library/yui/');
// => 'YUI Library is awesome!'
Y.Router Mechanics

            Y.Router

              history:change

   save/replace()

                               popstate
           Y.History
    pushState()
                               hashchange
Built on Solid Core
•Y.Base          •Y.ArrayList
•Y.Attribute     •Y.Node
•Y.EventTarget   •Y.History
•Y.io
•Y.JSON
•Y.Array
4.6KB
BIG
Community Adoption
What’s Coming
App Framework — 3.5.0
Y.App
Foundation and Structure
Sample Users App
var usersApp = new Y.App({
    views: {
        users: {
             type    : Y.UsersView,
             preserve: true
        },

          user: {
              type : Y.UserView,
              parent: 'users'
          }
      }
});
Sample Users App
var usersApp = new Y.App({
    views: {
        users: {
             type    : Y.UsersView,
             preserve: true
        },

          user: {
              type : Y.UserView,
              parent: 'users'
          }
      }
});
Sample Users App
var usersApp = new Y.App({
    views: {
        users: {
             type    : Y.UsersView,
             preserve: true
        },

          user: {
              type : Y.UserView,
              parent: 'users'
          }
      }
});
Sample Users App
var usersApp = new Y.App({
    views: {
        users: {
             type    : Y.UsersView,
             preserve: true
        },

          user: {
              type : Y.UserView,
              parent: 'users'
          }
      }
});
Sample Users App
var usersApp = new Y.App({
    views: {
        users: {
             type    : Y.UsersView,
             preserve: true
        },

          user: {
              type : Y.UserView,
              parent: 'users'
          }
      }
});
Sample Users App
var users = new Y.UsersList();

usersApp.route('/user/', function () {
    this.showView('users', {modelList: users});
});

usersApp.route('/user/:id/', function (req) {
    var user = users.getById(req.params.id);

      this.showView('user', {model: user}, function (view) {
          // Called after transition.
      });
});
Sample Users App
var users = new Y.UsersList();

usersApp.route('/user/', function () {
    this.showView('users', {modelList: users});
});

usersApp.route('/user/:id/', function (req) {
    var user = users.getById(req.params.id);

      this.showView('user', {model: user}, function (view) {
          // Called after transition.
      });
});
Sample Users App
var users = new Y.UsersList();

usersApp.route('/user/', function () {
    this.showView('users', {modelList: users});
});

usersApp.route('/user/:id/', function (req) {
    var user = users.getById(req.params.id);

      this.showView('user', {model: user}, function (view) {
          // Called after transition.
      });
});
Sample Users App
var users = new Y.UsersList();

usersApp.route('/user/', function () {
    this.showView('users', {modelList: users});
});

usersApp.route('/user/:id/', function (req) {
    var user = users.getById(req.params.id);

      this.showView('user', {model: user}, function (view) {
          // Called after transition.
      });
});
Sample Users App
var users = new Y.UsersList();

usersApp.route('/user/', function () {
    this.showView('users', {modelList: users});
});

usersApp.route('/user/:id/', function (req) {
    var user = users.getById(req.params.id);

      this.showView('user', {model: user}, function (view) {
          // Called after transition.
      });
});
Sample Users App
var users = new Y.UsersList();

usersApp.route('/user/', function () {
    this.showView('users', {modelList: users});
});

usersApp.route('/user/:id/', function (req) {
    var user = users.getById(req.params.id);

      this.showView('user', {model: user}, function (view) {
          // Called after transition.
      });
});
Sample Users App
var users = new Y.UsersList();

usersApp.route('/user/', function () {
    this.showView('users', {modelList: users});
});

usersApp.route('/user/:id/', function (req) {
    var user = users.getById(req.params.id);

      this.showView('user', {model: user}, function (view) {
          // Called after transition.
      });
});
Enhanced Navigation
Enhanced Navigation
pushState + Ajax =

     pjax
pushState + Ajax = pjax
• Handles link clicks
• Update full URL
• Dynamically load & render content
• Ajax !=== XHR
• Browser’s Back/Forward buttons work!
• Seamless
Y.Pjax

 Y.Router

             Y.PjaxBase


 Y.Pjax

 Y.History
Y.Pjax Mechanics

                          setContent()

link click   navigate()      DOM

              Y.Pjax
                              XHR
                           Server
Recap Y.App
• Is a View
• Is a Router
• Uses PjaxBase
• Has an activeView
• Manages View lifecycles & transitions
• Instantiate or sub-class
Templating
{{#with handlebars}}
Handlebars Templates
<script id="entry-template" type="text/x-handlebars-template">

    <div class="entry">
        <h1><{{title}}</h1>

        {{#if author}}
        <p class="author">{{author}}</p>
        {{/if}}

        <div class="body">{{body}}</div>
    </div>

</script>
Handlebars Templates
<script id="entry-template" type="text/x-handlebars-template">

    <div class="entry">
        <h1><{{title}}</h1>

        {{#if author}}
        <p class="author">{{author}}</p>
        {{/if}}

        <div class="body">{{body}}</div>
    </div>

</script>
Handlebars Templates
<script id="entry-template" type="text/x-handlebars-template">

    <div class="entry">
        <h1><{{title}}</h1>

        {{#if author}}
        <p class="author">{{author}}</p>
        {{/if}}

        <div class="body">{{body}}</div>
    </div>

</script>
Handlebars Templates
<script id="entry-template" type="text/x-handlebars-template">

    <div class="entry">
        <h1><{{title}}</h1>

        {{#if author}}
        <p class="author">{{author}}</p>
        {{/if}}

        <div class="body">{{body}}</div>
    </div>

</script>
Handlebars Templates
<script id="entry-template" type="text/x-handlebars-template">

    <div class="entry">
        <h1><{{title}}</h1>

        {{#if author}}
        <p class="author">{{author}}</p>
        {{/if}}

        <div class="body">{{body}}</div>
    </div>

</script>
Handlebars Templates
<script id="entry-template" type="text/x-handlebars-template">

    <div class="entry">
        <h1><{{title}}</h1>

        {{#if author}}
        <p class="author">{{author}}</p>
        {{/if}}

        <div class="body">{{body}}</div>
    </div>

</script>
Handlebars Templates
<script id="entry-template" type="text/x-handlebars-template">

    <div class="entry">
        <h1><{{title}}</h1>

        {{#if author}}
        <p class="author">{{author}}</p>
        {{/if}}

        <div class="body">{{body}}</div>
    </div>

</script>
Y.Handlebars
YUI().use('handlebars', 'node-base', function (Y) {

      var template = Y.one('#entry-template').getContent(),
          render   = Y.Handlebars.compile(template),
          entry    = {
              title : 'The Adventures of Tom Selleck',
              body : 'Tom crossed the river in his Ferrari…',
              author: 'Ryan Grove'
          };

      Y.one('#entry').setContent(render(entry));

});
Y.Handlebars
YUI().use('handlebars', 'node-base', function (Y) {

      var template = Y.one('#entry-template').getContent(),
          render   = Y.Handlebars.compile(template),
          entry    = {
              title : 'The Adventures of Tom Selleck',
              body : 'Tom crossed the river in his Ferrari…',
              author: 'Ryan Grove'
          };

      Y.one('#entry').setContent(render(entry));

});
Y.Handlebars
YUI().use('handlebars', 'node-base', function (Y) {

      var template = Y.one('#entry-template').getContent(),
          render   = Y.Handlebars.compile(template),
          entry    = {
              title : 'The Adventures of Tom Selleck',
              body : 'Tom crossed the river in his Ferrari…',
              author: 'Ryan Grove'
          };

      Y.one('#entry').setContent(render(entry));

});
Y.Handlebars
YUI().use('handlebars', 'node-base', function (Y) {

      var template = Y.one('#entry-template').getContent(),
          render   = Y.Handlebars.compile(template),
          entry    = {
              title : 'The Adventures of Tom Selleck',
              body : 'Tom crossed the river in his Ferrari…',
              author: 'Ryan Grove'
          };

      Y.one('#entry').setContent(render(entry));

});
Y.Handlebars
YUI().use('handlebars', 'node-base', function (Y) {

      var template = Y.one('#entry-template').getContent(),
          render   = Y.Handlebars.compile(template),
          entry    = {
              title : 'The Adventures of Tom Selleck',
              body : 'Tom crossed the river in his Ferrari…',
              author: 'Ryan Grove'
          };

      Y.one('#entry').setContent(render(entry));

});
Y.Handlebars
YUI().use('handlebars', 'node-base', function (Y) {

      var template = Y.one('#entry-template').getContent(),
          render   = Y.Handlebars.compile(template),
          entry    = {
              title : 'The Adventures of Tom Selleck',
              body : 'Tom crossed the river in his Ferrari…',
              author: 'Ryan Grove'
          };

      Y.one('#entry').setContent(render(entry));

});
Server-Side
Guides
Photos Near Me
 http://photosnear.me
Photos Near Me
• Built with App Framework
• Uses Y.App and Y.Handlebars
• ~ 650 Lines of JavaScript
• Responsive Design
• http://photosnear.me
• https://github.com/ericf/photosnear.me
PhotosNearMe (Y.App)
PhotosNearMe (Y.App)
Place (Y.Model)


                  Photos (Y.ModelList)
PhotosNearMe (Y.App)


GridView (Y.View)
PhotosNearMe (Y.App)
PhotosNearMe (Y.App)
Place (Y.Model)

                  Photo (Y.Model)
PhotosNearMe (Y.App)


LightboxView (Y.View)
Future…
App Framework — 3.6.0+
Dealing with Data
• Improved data access
• Model sync layers
• Data binding
Breadth & Depth
• View extensions & plugins
• View-based widgets
• More mobile
• More server
Questions?
  Ask away!



              Eric Ferraiuolo
                       @ericf

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 

Kürzlich hochgeladen (20)

Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 

Empfohlen

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Empfohlen (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

App framework — You’ve Been Wanting This

  • 1. YUI App Framework You’ve Been Wanting This Eric Ferraiuolo @ericf
  • 2. MVC
  • 5. Y.Model • Manages data/state • Observable attributes • Coalesced change event • Contains business logic • Has data-syncing layer
  • 6. Y.ModelList 1 foo 2 foo 3 foo set() 4 foo 5 foo 6 foo 7 foo
  • 7. Y.ModelList } 1 foo 2 foo 3 foo set() 4 foo foo:change 5 foo 6 foo 7 foo
  • 9. Y.View • Containment • Render-able (you provide rendering logic) • BYO-Template • Declarative event subscriptions • Lightweight
  • 11. Y.Controller Y.Router • Basic navigation management • Uses HTML5 pushState & popstate • Degrades to hash-based history • Bookmark-able URLs • Browser back/forward buttons work! • Wire-up application states to routes
  • 12. Y.Router Example var router = new Y.Router(); router.route('/library/:lib/', function (req) { var lib = req.params.lib; if (lib === 'yui') { Y.log('YUI Library is awesome!'); } }); router.save('/library/yui/'); // => 'YUI Library is awesome!'
  • 13. Y.Router Example var router = new Y.Router(); router.route('/library/:lib/', function (req) { var lib = req.params.lib; if (lib === 'yui') { Y.log('YUI Library is awesome!'); } }); router.save('/library/yui/'); // => 'YUI Library is awesome!'
  • 14. Y.Router Example var router = new Y.Router(); router.route('/library/:lib/', function (req) { var lib = req.params.lib; if (lib === 'yui') { Y.log('YUI Library is awesome!'); } }); router.save('/library/yui/'); // => 'YUI Library is awesome!'
  • 15. Y.Router Example var router = new Y.Router(); router.route('/library/:lib/', function (req) { var lib = req.params.lib; if (lib === 'yui') { Y.log('YUI Library is awesome!'); } }); router.save('/library/yui/'); // => 'YUI Library is awesome!'
  • 16. Y.Router Example var router = new Y.Router(); router.route('/library/:lib/', function (req) { var lib = req.params.lib; if (lib === 'yui') { Y.log('YUI Library is awesome!'); } }); router.save('/library/yui/'); // => 'YUI Library is awesome!'
  • 17. Y.Router Example var router = new Y.Router(); router.route('/library/:lib/', function (req) { var lib = req.params.lib; if (lib === 'yui') { Y.log('YUI Library is awesome!'); } }); router.save('/library/yui/'); // => 'YUI Library is awesome!'
  • 18. Y.Router Mechanics Y.Router history:change save/replace() popstate Y.History pushState() hashchange
  • 19. Built on Solid Core •Y.Base •Y.ArrayList •Y.Attribute •Y.Node •Y.EventTarget •Y.History •Y.io •Y.JSON •Y.Array
  • 20. 4.6KB
  • 23. Y.App
  • 25. Sample Users App var usersApp = new Y.App({ views: { users: { type : Y.UsersView, preserve: true }, user: { type : Y.UserView, parent: 'users' } } });
  • 26. Sample Users App var usersApp = new Y.App({ views: { users: { type : Y.UsersView, preserve: true }, user: { type : Y.UserView, parent: 'users' } } });
  • 27. Sample Users App var usersApp = new Y.App({ views: { users: { type : Y.UsersView, preserve: true }, user: { type : Y.UserView, parent: 'users' } } });
  • 28. Sample Users App var usersApp = new Y.App({ views: { users: { type : Y.UsersView, preserve: true }, user: { type : Y.UserView, parent: 'users' } } });
  • 29. Sample Users App var usersApp = new Y.App({ views: { users: { type : Y.UsersView, preserve: true }, user: { type : Y.UserView, parent: 'users' } } });
  • 30. Sample Users App var users = new Y.UsersList(); usersApp.route('/user/', function () { this.showView('users', {modelList: users}); }); usersApp.route('/user/:id/', function (req) { var user = users.getById(req.params.id); this.showView('user', {model: user}, function (view) { // Called after transition. }); });
  • 31. Sample Users App var users = new Y.UsersList(); usersApp.route('/user/', function () { this.showView('users', {modelList: users}); }); usersApp.route('/user/:id/', function (req) { var user = users.getById(req.params.id); this.showView('user', {model: user}, function (view) { // Called after transition. }); });
  • 32. Sample Users App var users = new Y.UsersList(); usersApp.route('/user/', function () { this.showView('users', {modelList: users}); }); usersApp.route('/user/:id/', function (req) { var user = users.getById(req.params.id); this.showView('user', {model: user}, function (view) { // Called after transition. }); });
  • 33. Sample Users App var users = new Y.UsersList(); usersApp.route('/user/', function () { this.showView('users', {modelList: users}); }); usersApp.route('/user/:id/', function (req) { var user = users.getById(req.params.id); this.showView('user', {model: user}, function (view) { // Called after transition. }); });
  • 34. Sample Users App var users = new Y.UsersList(); usersApp.route('/user/', function () { this.showView('users', {modelList: users}); }); usersApp.route('/user/:id/', function (req) { var user = users.getById(req.params.id); this.showView('user', {model: user}, function (view) { // Called after transition. }); });
  • 35. Sample Users App var users = new Y.UsersList(); usersApp.route('/user/', function () { this.showView('users', {modelList: users}); }); usersApp.route('/user/:id/', function (req) { var user = users.getById(req.params.id); this.showView('user', {model: user}, function (view) { // Called after transition. }); });
  • 36. Sample Users App var users = new Y.UsersList(); usersApp.route('/user/', function () { this.showView('users', {modelList: users}); }); usersApp.route('/user/:id/', function (req) { var user = users.getById(req.params.id); this.showView('user', {model: user}, function (view) { // Called after transition. }); });
  • 39.
  • 41. pushState + Ajax = pjax • Handles link clicks • Update full URL • Dynamically load & render content • Ajax !=== XHR • Browser’s Back/Forward buttons work! • Seamless
  • 42. Y.Pjax Y.Router Y.PjaxBase Y.Pjax Y.History
  • 43. Y.Pjax Mechanics setContent() link click navigate() DOM Y.Pjax XHR Server
  • 44. Recap Y.App • Is a View • Is a Router • Uses PjaxBase • Has an activeView • Manages View lifecycles & transitions • Instantiate or sub-class
  • 47. Handlebars Templates <script id="entry-template" type="text/x-handlebars-template"> <div class="entry"> <h1><{{title}}</h1> {{#if author}} <p class="author">{{author}}</p> {{/if}} <div class="body">{{body}}</div> </div> </script>
  • 48. Handlebars Templates <script id="entry-template" type="text/x-handlebars-template"> <div class="entry"> <h1><{{title}}</h1> {{#if author}} <p class="author">{{author}}</p> {{/if}} <div class="body">{{body}}</div> </div> </script>
  • 49. Handlebars Templates <script id="entry-template" type="text/x-handlebars-template"> <div class="entry"> <h1><{{title}}</h1> {{#if author}} <p class="author">{{author}}</p> {{/if}} <div class="body">{{body}}</div> </div> </script>
  • 50. Handlebars Templates <script id="entry-template" type="text/x-handlebars-template"> <div class="entry"> <h1><{{title}}</h1> {{#if author}} <p class="author">{{author}}</p> {{/if}} <div class="body">{{body}}</div> </div> </script>
  • 51. Handlebars Templates <script id="entry-template" type="text/x-handlebars-template"> <div class="entry"> <h1><{{title}}</h1> {{#if author}} <p class="author">{{author}}</p> {{/if}} <div class="body">{{body}}</div> </div> </script>
  • 52. Handlebars Templates <script id="entry-template" type="text/x-handlebars-template"> <div class="entry"> <h1><{{title}}</h1> {{#if author}} <p class="author">{{author}}</p> {{/if}} <div class="body">{{body}}</div> </div> </script>
  • 53. Handlebars Templates <script id="entry-template" type="text/x-handlebars-template"> <div class="entry"> <h1><{{title}}</h1> {{#if author}} <p class="author">{{author}}</p> {{/if}} <div class="body">{{body}}</div> </div> </script>
  • 54. Y.Handlebars YUI().use('handlebars', 'node-base', function (Y) { var template = Y.one('#entry-template').getContent(), render = Y.Handlebars.compile(template), entry = { title : 'The Adventures of Tom Selleck', body : 'Tom crossed the river in his Ferrari…', author: 'Ryan Grove' }; Y.one('#entry').setContent(render(entry)); });
  • 55. Y.Handlebars YUI().use('handlebars', 'node-base', function (Y) { var template = Y.one('#entry-template').getContent(), render = Y.Handlebars.compile(template), entry = { title : 'The Adventures of Tom Selleck', body : 'Tom crossed the river in his Ferrari…', author: 'Ryan Grove' }; Y.one('#entry').setContent(render(entry)); });
  • 56. Y.Handlebars YUI().use('handlebars', 'node-base', function (Y) { var template = Y.one('#entry-template').getContent(), render = Y.Handlebars.compile(template), entry = { title : 'The Adventures of Tom Selleck', body : 'Tom crossed the river in his Ferrari…', author: 'Ryan Grove' }; Y.one('#entry').setContent(render(entry)); });
  • 57. Y.Handlebars YUI().use('handlebars', 'node-base', function (Y) { var template = Y.one('#entry-template').getContent(), render = Y.Handlebars.compile(template), entry = { title : 'The Adventures of Tom Selleck', body : 'Tom crossed the river in his Ferrari…', author: 'Ryan Grove' }; Y.one('#entry').setContent(render(entry)); });
  • 58. Y.Handlebars YUI().use('handlebars', 'node-base', function (Y) { var template = Y.one('#entry-template').getContent(), render = Y.Handlebars.compile(template), entry = { title : 'The Adventures of Tom Selleck', body : 'Tom crossed the river in his Ferrari…', author: 'Ryan Grove' }; Y.one('#entry').setContent(render(entry)); });
  • 59. Y.Handlebars YUI().use('handlebars', 'node-base', function (Y) { var template = Y.one('#entry-template').getContent(), render = Y.Handlebars.compile(template), entry = { title : 'The Adventures of Tom Selleck', body : 'Tom crossed the river in his Ferrari…', author: 'Ryan Grove' }; Y.one('#entry').setContent(render(entry)); });
  • 61.
  • 63. Photos Near Me http://photosnear.me
  • 64. Photos Near Me • Built with App Framework • Uses Y.App and Y.Handlebars • ~ 650 Lines of JavaScript • Responsive Design • http://photosnear.me • https://github.com/ericf/photosnear.me
  • 65.
  • 67. PhotosNearMe (Y.App) Place (Y.Model) Photos (Y.ModelList)
  • 69.
  • 74. Dealing with Data • Improved data access • Model sync layers • Data binding
  • 75. Breadth & Depth • View extensions & plugins • View-based widgets • More mobile • More server
  • 76. Questions? Ask away! Eric Ferraiuolo @ericf