I would like to know if there is an event that is called when a page is destroyed/changed. For example i'm in localhost:3000
and i would like to navigate to localhost:3000/articles
but before that i need to destroy some javascripts components, so i was wondering if there is a way to have something like
我想知道是否在页面被销毁/更改时调用了一个事件。例如我在localhost:3000,我想导航到localhost:3000 /文章,但在此之前我需要销毁一些javascripts组件,所以我想知道是否有办法有类似的东西
$(document).on('turbolinks:before-destroy', function() {});
Or something like that.
或类似的东西。
1 个解决方案
#1
0
This was solved. I found the list of events for turbolinks: github.com/turbolinks/turbolinks#full-list-of-events. The one i was looking for is turbolinks:before-visit
这解决了。我找到了turbolinks的事件列表:github.com/turbolinks/turbolinks#full-list-of-events。我正在寻找的是turbolinks:访问前
#1
0
This was solved. I found the list of events for turbolinks: github.com/turbolinks/turbolinks#full-list-of-events. The one i was looking for is turbolinks:before-visit
这解决了。我找到了turbolinks的事件列表:github.com/turbolinks/turbolinks#full-list-of-events。我正在寻找的是turbolinks:访问前