SlideShare a Scribd company logo
New Javascript Architecture
bidu.com.br
Namespace
window.Bidu = {	

	

 pages : {},	

	

 utils : {}	

};
window.Bidu = {	

pages : {	

Home : {	

init : function () {	

//do something	

},	

events : {	

“click #logo” : “refreshPage”,	

“click .menuItem” : “openSubMenu”	

},	

refreshPage : function () {},	

openSubMenu : function () {}	

}	

}	

};
Singleton Pattern
( function (Bidu, undefined) {	

// private properties

var foo = "foo";	

// private methods 

function speak(msg) {

console.log("You said: " + msg);

};	

// public methods and properties 

Bidu.pages.CarForm = {	

init : function() {	

speak("Funcionou! " + foo);	

},	

events : {	

"click .icon" : "open",	

}	

open : function (){}	

};	

}(window.Bidu = window.Bidu || {}));
Module
Page Load Define Namespace
Define Modules
Trigger
Document.Ready
Function
Auto call init
function and bind
events
Page Ready
Runtime Events
Trigger Document.Ready
Function
Go to BODY
element
Find a CTRL
attribute
Find Module with
the name of
attribute value
Auto call init
function and bind
events
How Stuff Works
On Application.html.erb	

"
	

 <body ctrl="<%= yield :ctrl_id %>">
On each main page	

"
<%= content_for :ctrl_id do %>CarForm<% end %>	

Module name
Steps
• First:	

• Move all form pages (vehicle assurance) to new format
• Second:	

• Refactor the code to each interaction
this is it

More Related Content

What's hot

BDD revolution - or how we came back from hell
BDD revolution - or how we came back from hellBDD revolution - or how we came back from hell
BDD revolution - or how we came back from hell
Mateusz Zalewski
 
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Puppet
 
Crowdsourcing with Django
Crowdsourcing with DjangoCrowdsourcing with Django
Crowdsourcing with Django
Simon Willison
 
Hybrid Cloud: One & AWS & Terraform
Hybrid Cloud: One & AWS & TerraformHybrid Cloud: One & AWS & Terraform
Hybrid Cloud: One & AWS & Terraform
CSUC - Consorci de Serveis Universitaris de Catalunya
 
API Design
API DesignAPI Design
API Design
Eddie Kao
 
Growing jQuery
Growing jQueryGrowing jQuery
Growing jQuery
gueste8d8bc
 
Perl6 operators and metaoperators
Perl6   operators and metaoperatorsPerl6   operators and metaoperators
Perl6 operators and metaoperators
Simon Proctor
 
Javascript 基础
Javascript 基础Javascript 基础
Javascript 基础
Alipay
 
The Web beyond "usernames & passwords" (OSDC12)
The Web beyond "usernames & passwords" (OSDC12)The Web beyond "usernames & passwords" (OSDC12)
The Web beyond "usernames & passwords" (OSDC12)
Francois Marier
 
Php if
Php ifPhp if
Decoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesDecoupling Objects With Standard Interfaces
Decoupling Objects With Standard Interfaces
Thomas Weinert
 

What's hot (11)

BDD revolution - or how we came back from hell
BDD revolution - or how we came back from hellBDD revolution - or how we came back from hell
BDD revolution - or how we came back from hell
 
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
 
Crowdsourcing with Django
Crowdsourcing with DjangoCrowdsourcing with Django
Crowdsourcing with Django
 
Hybrid Cloud: One & AWS & Terraform
Hybrid Cloud: One & AWS & TerraformHybrid Cloud: One & AWS & Terraform
Hybrid Cloud: One & AWS & Terraform
 
API Design
API DesignAPI Design
API Design
 
Growing jQuery
Growing jQueryGrowing jQuery
Growing jQuery
 
Perl6 operators and metaoperators
Perl6   operators and metaoperatorsPerl6   operators and metaoperators
Perl6 operators and metaoperators
 
Javascript 基础
Javascript 基础Javascript 基础
Javascript 基础
 
The Web beyond "usernames & passwords" (OSDC12)
The Web beyond "usernames & passwords" (OSDC12)The Web beyond "usernames & passwords" (OSDC12)
The Web beyond "usernames & passwords" (OSDC12)
 
Php if
Php ifPhp if
Php if
 
Decoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesDecoupling Objects With Standard Interfaces
Decoupling Objects With Standard Interfaces
 

Viewers also liked

Somatica e gf engenharia apresentação 2015 v3b
Somatica e gf engenharia apresentação 2015  v3bSomatica e gf engenharia apresentação 2015  v3b
Somatica e gf engenharia apresentação 2015 v3b
Paulo Frazilio Mechanical Engineer
 
Parceria central de monitoramento empresas de segurança eletrônica
Parceria central de monitoramento   empresas de segurança eletrônicaParceria central de monitoramento   empresas de segurança eletrônica
Parceria central de monitoramento empresas de segurança eletrônica
Maximus Estética Automotiva
 
Apresentação TRANSFORME
Apresentação TRANSFORMEApresentação TRANSFORME
Apresentação TRANSFORME
Antonio Mendes Camilo
 
Plano de marketing
Plano de marketingPlano de marketing
Plano de marketing
GORGATI CONSULTORIA
 
Funeraria boa viagem eco
Funeraria boa viagem ecoFuneraria boa viagem eco
Funeraria boa viagem eco
Alexandre bezerraxan
 
PGRSS HNSC Apresentação
PGRSS HNSC ApresentaçãoPGRSS HNSC Apresentação
PGRSS HNSC Apresentação
Everton Ianiak
 
Funeraria..
Funeraria..Funeraria..
Funeraria..
bartolomeu67
 
Plano de marketing modelo
Plano de marketing modeloPlano de marketing modelo
Plano de marketing modelo
Walter Mendonça
 

Viewers also liked (8)

Somatica e gf engenharia apresentação 2015 v3b
Somatica e gf engenharia apresentação 2015  v3bSomatica e gf engenharia apresentação 2015  v3b
Somatica e gf engenharia apresentação 2015 v3b
 
Parceria central de monitoramento empresas de segurança eletrônica
Parceria central de monitoramento   empresas de segurança eletrônicaParceria central de monitoramento   empresas de segurança eletrônica
Parceria central de monitoramento empresas de segurança eletrônica
 
Apresentação TRANSFORME
Apresentação TRANSFORMEApresentação TRANSFORME
Apresentação TRANSFORME
 
Plano de marketing
Plano de marketingPlano de marketing
Plano de marketing
 
Funeraria boa viagem eco
Funeraria boa viagem ecoFuneraria boa viagem eco
Funeraria boa viagem eco
 
PGRSS HNSC Apresentação
PGRSS HNSC ApresentaçãoPGRSS HNSC Apresentação
PGRSS HNSC Apresentação
 
Funeraria..
Funeraria..Funeraria..
Funeraria..
 
Plano de marketing modelo
Plano de marketing modeloPlano de marketing modelo
Plano de marketing modelo
 

Similar to Js Project - Architecture

Prototype UI
Prototype UIPrototype UI
Prototype UI
Sébastien Gruhier
 
A test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobileA test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobile
GlobalLogic Ukraine
 
Pinned Sites IE 9 Lightup
Pinned Sites IE 9 LightupPinned Sites IE 9 Lightup
Pinned Sites IE 9 Lightup
Wes Yanaga
 
Prototype UI Intro
Prototype UI IntroPrototype UI Intro
Prototype UI Intro
Juriy Zaytsev
 
Chrome extension development
Chrome extension developmentChrome extension development
Chrome extension development
Mārtiņš Balodis
 
The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
Robert Nyman
 
JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
Robert Nyman
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
Michael Girouard
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
rajivmordani
 
Chrome Extensions for Hackers
Chrome Extensions for HackersChrome Extensions for Hackers
Chrome Extensions for Hackers
Cristiano Betta
 
Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
baygross
 
HTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - AltranHTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - Altran
Robert Nyman
 
WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.js
Robert Nyman
 
meet.js - QooXDoo
meet.js - QooXDoomeet.js - QooXDoo
meet.js - QooXDoo
Radek Benkel
 
Writing browser extensions_in_kotlin
Writing browser extensions_in_kotlinWriting browser extensions_in_kotlin
Writing browser extensions_in_kotlin
xavazque2
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
Andrew Dupont
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
Luke Summerfield
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Tsuyoshi Yamamoto
 
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
Alkacon Software GmbH & Co. KG
 
Geb presentation
Geb presentationGeb presentation
Geb presentation
Ivar Østhus
 

Similar to Js Project - Architecture (20)

Prototype UI
Prototype UIPrototype UI
Prototype UI
 
A test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobileA test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobile
 
Pinned Sites IE 9 Lightup
Pinned Sites IE 9 LightupPinned Sites IE 9 Lightup
Pinned Sites IE 9 Lightup
 
Prototype UI Intro
Prototype UI IntroPrototype UI Intro
Prototype UI Intro
 
Chrome extension development
Chrome extension developmentChrome extension development
Chrome extension development
 
The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
 
JavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the PlatformJavaScript APIs - The Web is the Platform
JavaScript APIs - The Web is the Platform
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
Chrome Extensions for Hackers
Chrome Extensions for HackersChrome Extensions for Hackers
Chrome Extensions for Hackers
 
Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
 
HTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - AltranHTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - Altran
 
WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.js
 
meet.js - QooXDoo
meet.js - QooXDoomeet.js - QooXDoo
meet.js - QooXDoo
 
Writing browser extensions_in_kotlin
Writing browser extensions_in_kotlinWriting browser extensions_in_kotlin
Writing browser extensions_in_kotlin
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5OpenCms Days 2014 - User Generated Content in OpenCms 9.5
OpenCms Days 2014 - User Generated Content in OpenCms 9.5
 
Geb presentation
Geb presentationGeb presentation
Geb presentation
 

Recently uploaded

GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
FODUU
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
Techgropse Pvt.Ltd.
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 

Recently uploaded (20)

GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 

Js Project - Architecture

  • 2. Namespace window.Bidu = { pages : {}, utils : {} };
  • 3. window.Bidu = { pages : { Home : { init : function () { //do something }, events : { “click #logo” : “refreshPage”, “click .menuItem” : “openSubMenu” }, refreshPage : function () {}, openSubMenu : function () {} } } }; Singleton Pattern
  • 4. ( function (Bidu, undefined) { // private properties
 var foo = "foo"; // private methods 
 function speak(msg) {
 console.log("You said: " + msg);
 }; // public methods and properties 
 Bidu.pages.CarForm = { init : function() { speak("Funcionou! " + foo); }, events : { "click .icon" : "open", } open : function (){} }; }(window.Bidu = window.Bidu || {})); Module
  • 5. Page Load Define Namespace Define Modules Trigger Document.Ready Function Auto call init function and bind events Page Ready Runtime Events
  • 6. Trigger Document.Ready Function Go to BODY element Find a CTRL attribute Find Module with the name of attribute value Auto call init function and bind events
  • 7. How Stuff Works On Application.html.erb " <body ctrl="<%= yield :ctrl_id %>"> On each main page " <%= content_for :ctrl_id do %>CarForm<% end %> Module name
  • 8. Steps • First: • Move all form pages (vehicle assurance) to new format • Second: • Refactor the code to each interaction