SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
JAVASCRIPT @ MEME
THE STRUCTURE
js/app (goodstuff.*, JSLint)
vs
js/ext (jquery.*, Updates)
THE STRATEGY
PERFORMANCE & ACESSIBILITY
FOCUS
NO TECHNIQUE
GRACEFUL DEGRADATION
PROGRESSIVE ENHANCEMENT
PROGRESSIVE ENHANCEMENT
VS
GRACEFUL DEGRADATION
GRACEFUL DEGRADATION (1994)
PROGRESSIVE ENHANCEMENT (2003)
THE MAIN CONCEPTS
SEMANTIC HTML
ACCESSIBILITY & SEO
Vs
<form class=”repost”action=".../repost/" method="post”>
<input type="submit">
</form>
<div class=”repost_button” onclick=”do_repost(...);”></div>
BOTTOM SCRIPTS
PERFORMANCE & FAULT TOLERANCE
[...]
add_js_src(“”)
add_js_src(“”)
add_js_inline(“”)
[...]
</body>
ADD_JS_SRC
AUTO BOTTOM
AUTO MERGED
IDEMPOTENT
ADD_JS_INLINE
AUTO BOTTOM
AUTO MERGED
IDEMPOTENT
IMPLEMENTATION FREE?
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_inline(“ $.onready( function () {
load_follow(“”);
load_repost(“”);
}));
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_inline(“ $.onready( function () {
load_follow(“”);
load_repost(“”);
}));
WHY NOT?
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_src(“”);
add_js_inline(“ $.onready( function () {
load_follow(“”);
load_repost(“”);
}));
WHAT IS HAPPENING?
NOT READY
NO CACHE
AJAX
<a href=”#” class=”follow” onclick=”follow(...); ”>
Follow
</a>
THE BAD CODE FIRST
<form class=”follow” action=".../follow/..." method="post”>
<input type="submit">
</form>
[...]
<script>
...set_form_ajax(follow_forms,...);
</script>
THE GOOD CODE
REPOST
FOLLOW
MORE (DASHBOARD)
COMMENT
CASES
THE FRAMEWORK
HTTP GET
goodstuff.ajax.set_link_ajax(element, success, error, loading);
HTTP POST
goodstuff.ajax.set_form_ajax(element, success, error, loading);
FOR FREE
SEMANTIC REQUESTS
LINKS = GETS (MORE)
FORMS = POSTS (REPOST)
FOR FREE
AJAX RESPONSE WITH CONTEXT
var success_function = function (context) {
[...]
}
goodstuff.ajax.set_link_ajax(element, success, ...);
FOR FREE
CRUMB
CLICK CONTROL
...AND ANY OTHER IMPROVEMENT
THE CODE
goodstuff.ajax.some_ajax = function () {
var error, success, loading;
error = function (response, context) {
[...]
};
success = function (response, context) {
[...]
};
loading = function (context) {
[...]
};
goodstuff.ajax.set_link_ajax(link, error, success, loading);
};
BIND JSON TO TEMPLATE
THE PROBLEM
ATTEMPTS
1. HTML directly in the js
ATTEMPTS
1. HTML directly in the js
11. DOM Manipulation in the js
ATTEMPTS
1. HTML directly in the js
11. DOM Manipulation in the js
111. Clone the last element
ATTEMPTS
1. HTML directly in the js
11. DOM Manipulation in the js
111. Clone the last element
THE SOLUTION
$template = $framework->getJSONTemplate(...)
+
goodstuff.ajax.bind_json_template(json_data, template);
template.php
view.php
ajax.js
THAT IS ALL, FOLKS

Weitere ähnliche Inhalte

Ähnlich wie Js atmeme

Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Masashi Shibata
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Igor Bronovskyy
 

Ähnlich wie Js atmeme (20)

JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
How to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI ComponentsHow to Mess Up Your Angular UI Components
How to Mess Up Your Angular UI Components
 
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVCConstruindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Introduction à AngularJS
Introduction à AngularJSIntroduction à AngularJS
Introduction à AngularJS
 
React lecture
React lectureReact lecture
React lecture
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
 
前端概述
前端概述前端概述
前端概述
 
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
Introduction to backbone presentation
Introduction to backbone presentationIntroduction to backbone presentation
Introduction to backbone presentation
 
Using RequireJS with CakePHP
Using RequireJS with CakePHPUsing RequireJS with CakePHP
Using RequireJS with CakePHP
 
The Google App Engine Oil Framework
The Google App Engine Oil FrameworkThe Google App Engine Oil Framework
The Google App Engine Oil Framework
 
Backbone js in drupal core
Backbone js in drupal coreBackbone js in drupal core
Backbone js in drupal core
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
Extend sdk
Extend sdkExtend sdk
Extend sdk
 
Angular JS Introduction
Angular JS IntroductionAngular JS Introduction
Angular JS Introduction
 
All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
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...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Js atmeme