Loading
Alexandre Barret
This is a live streamed presentation. You will automatically follow the presenter and see the slide they're currently on.
Features
Get the performance benefits of a single-page application without the added complexity of a client-side JavaScript framework.
Who uses it
Time (ms) | Description |
---|---|
10 | network latency |
50 | server response |
10 | network latency |
100 - 700 | parse html, create, render tree ... |
300 - 1500 | evaluate javascript |
100 - 250 | paint |
What is a visit
Responds with a full HTML response (no JSON)
document.body = xhr.querSelector('body');
What it does not do:
One javascript runtime
var audio = new Audio('<%= config[:http_prefix] %>audio/audio_file.mp3');
audio.oncanplaythrough = function(){
$('#player #play').prop("disabled", false);
$('#player #pause').prop("disabled", false);
}
var playMusic = function () {
audio.play();
};
var stopMusic = function () {
audio.pause();
};
$(document).on('click', '#player #play', playMusic);
$(document).on('click', '#player #pause', stopMusic);
<div id="player" data-turbolinks-permanent >
<p>Listen to my awesome music</p>
<button id="play" disabled>Play</button>
<button id="pause" disabled>Pause</button>
</div>
data-turbolinks-permanent
var number = 0;
setInterval(function() {
$('#counter p span').text(number);
number = number + 1
}, 1000);
<div id="counter" data-turbolinks-permanent>
<p>Number of downloads: <span>0</span>!</p>
</div>
Documentation
https://github.com/turbolinks/turbolinks
Resources