0
0

More than 3 years have passed since last update.

turbolinksとは

Posted at

turbolinksとは

  • TurbolinksはRails4.0からデフォルトで導入されたgem

  • ajaxとhistoryAPI(popState, pushState)を利用して画面遷移

  • js, cssの読み込みを初回時に行い次回以降の読み込み処理を省略することで高速化する。

主なTurbolinksの動作は2つ

fetchReplacement

  • <a>タグのリンクをクリックした時の遷移をajax化して画面遷移なしにページ遷移する。

  • clickイベントの挙動を変えている

fetchHistory

  • 戻るボタンなどを押した時のイベントを書き換えている

  • fetchReplacement時にpushStateでキャッシュしたページをpopStateで復元する。

参照

Turbolinksを調べてみた

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0