Date post: | 17-Jul-2015 |
Category: |
Technology |
Upload: | theodore-biadala |
View: | 55 times |
Download: | 1 times |
Javascript for backend developers
Théodore 'nod_' Biadala
Assumptions
Backend owlBackend owl
is inis in
ControlControl
Frontend FlamingoFrontend Flamingo
run fromrun from
ChaosChaos
You sort of care about frontendYou sort of worry about performance
You just want thing to work
Javascript LandscapeJavascript Landscape
HarmonyHarmony
Sugar Syntax
« Classes »
Modules
Android
BBIINNGGOO
AMD
CommonJS
UglifyJSUglifyJS
Isomorphic
PitfallsPitfallsVariable scope
Types
Callback hell
« Associative arrays »
'use strict' ;
BehaviorsBehaviorsDrupal.behaviors.initializeFlamingo = {
attach : function (context, settings) {
},
detach : function (context, settings, trigger) {}
} ;
context (after ajax call)
context (page load)
OnceOnce// In the attach function.
var $burgers = $(context).find('.burger') ;
// Salt to my burger(s).
$burgers.each(saltThisBurger) ;
// Don't add salt at every ajax request !
$burgers.once('salt').each(saltThisBurger) ;
once
once
Performance wolvesPerformance wolves
Javascript performance,Don't worry
DOM PerformanceDOM Performance
RepaintRepaint&&
ReflowReflow
Wolf-resistant ToolsWolf-resistant Tools
The problem with Angular The problem with Angular — — ppkppk