3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Turbolinks5のイベント

Last updated at Posted at 2016-07-13

ローカル開発環境を bundle update したら Turbolinks が動かなくなって困ったのでいろいろ調べた。1

Google で turbolinks rails のキーワードで検索してヒットするほとんどの記事に書いてある page:xxxx というイベントがまったく発生しなくなってることが判明。

記載時のバージョン

"version": "5.0.0"

イベントの一覧

Readmeからイベントを抜粋(いまいち理解できない箇所はそのまま、かつ、意訳してるのでまちがってたら指摘please)

イベント名 説明
turbolinks:click リンクをクリックしたときに発火。クリックされたelementがイベントターゲット。event.data.url からリクエスト先のURLを取得できる。Cancel this event to let the click fall through to the browser as normal navigation.
turbolinks:before-visit ヒストリーの場合を除きページ遷移ときに発火。event.data.url からリクエスト先のURLを取得できる。イベントをキャンセルすることでページ遷移を中断することができる。
turbolinks:visit ページ遷移が開始したら発火する。
turbolinks:request-start ネットワークを通じてリクエストが発行される前に発火。 event.data.xhr から XMLHttpRequest オブジェクトにアクセス可能。
turbolinks:request-end リクエスト完了後に発火。event.data.xhr から XMLHttpRequest オブジェクトにアクセス可能。
turbolinks:before-cache 現在のページをキャッシュにセーブする直前に発火。
turbolinks:before-render 現在のページをレンダリングする直前に発火。event.data.newBody から新しいエレメントにアクセス可能。
turbolinks:render ページのレンダリング完了直後に発火。このイベントはキャッシュされたページをレンダリングした場合、新しいページをレンダリング場合の2回発生?(This event fires twice during an application visit to a cached location: once after rendering the cached version, and again after rendering the fresh version.)
turbolinks:load 最初のページのロード時1回及び、Turbolinksによるページ遷移時に発火。event.data.timingから timing metrics にアクセス可能?(Access visit timing metrics with the event.data.timing object.)
  1. 更新前 turbolinks (2.5.3) -> 更新後 turbolinks (5.0.0) 一気にバージョン上がってるの気づかなかった...

3
4
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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?