Michael Bromley
Gentics Software
Current Technology
Limitations & Problems
Solutions & Innovations
Increased scope & complexity
// native DOM API
if (el.classList)
el.classList.contains(className);
else
new RegExp('(^| )' + className
+ '( |$)', 'gi').test(el.className);
// with jQuery
$(el).hasClass(className);
vs.
var request = new XMLHttpRequest();
request.open('GET', '/my/url', true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
// Success!
var data = JSON.parse(request.responseText);
} else {
// error response
}
};
request.onerror = function() {
// connection error of some sort
};
request.send();
$.getJSON('/my/url', function(data) {
});
vs.
Current Technology
Limitations & Problems
Solutions & Innovations
Increased scope & complexity
App
Sidebar
Contacts
Menu
Contents
ChatWindow
<App />
<Sidebar />
<Contents />
<Contacts />
<Menu />
<ChatWindow />
Parent Component
Child Component
Data
Callback
Callback( )
Data
function square(x) {
return x * x;
}
let a = [1, 2, 3, 4];
let b = a.map(square);
// b = [1, 4, 9, 16];
Function Programming in Javascript (interactive tutorial)
Immutable.js:
merge(a, b)
a
b
/* Get stock data somehow */
var source = getStockData();
source
.filter(quote => quote.price > 30)
.map(quote => quote.price)
.forEach(price => {
console.log('Prices higher than $30: $' + price);
});
Browser
JavaScript App
DOM (user interface)
Renders
Browser
JavaScript App
(core)
DOM (user interface)
Renders
JavaScript App
DOM renderer
Ready to render
Browser
JavaScript App (core)
DOM renderer
Server renderer
Server
Mobile native renderer
Mobile App
Transpiler
(e.g. Babel)
JavaScript
Browser
Slides: https://slides.com/michaelbromley/deck-6/