Help us understand the problem. What is going on with this article?

Rails5でTurbolinksの挙動が変わってた。

More than 3 years have passed since last update.

今までのイベント

$(document).on 'page:before-change' , -> console.log 'page:before-change'
$(document).on 'page:fetch'         , -> console.log 'page:fetch'
$(document).on 'page:receive'       , -> console.log 'page:receive'
$(document).on 'page:change'        , -> console.log 'page:change'
$(document).on 'page:update'        , -> console.log 'page:update'
$(document).on 'page:load'          , -> console.log 'page:load'
$(document).on 'ready page:load'    , -> console.log 'ready and load'
$(document).ready                     -> console.log '$(document).ready in assets'
$(window).on 'load'                 , -> console.log '$(window).load in assets'

これでJSが発火してくれていたが、、、

Rails5でのイベント

# ページ切り替え時(初回ページも対象)
$(document).on 'turbolinks:load', -> console.log 'turbolinks:load'
# ページ切り替え時(初回ページは対象外)
$(document).on 'turbolinks:render', -> console.log 'turbolinks:render'
# ページ遷移前
$(document).on 'turbolinks:request-start', -> console.log 'turbolinks:request-start'

これで発火するように変わってた。
当面はこの二つだけ知っていれば問題ないかな。

あと、ページにキャッシュするページ数とかを設定できそうだけど、今の所はまだ未調査。
部分レンダリングすらまだ使ってない。

TurbolinksのGithubはこちら。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした