0

I'm having some troubles using CrossriderAPI with turbolinks, my scenario is this:

1. Going on my http://website.local/

2. running a check to see if Crossrider extension is ready:

CrossriderAPI.isAppReady('xxxxx', function(r) { if (r) (console.log('ready')) })

3. yes of course, is it.

4. Navigating through the website (using turbolinks)

5. well, troubles start by here. turbolinks change the DOM to each request, but when I retry to check if Crossrider extension is ready, and I'm investigating why, what i receive is false. It seems not see anymore our extension.

I'm debugging this code to see if I get out from this problem.

has anyone succeeded with this? Any help or advice would be great!

Antonio

4

1 回答 1

1

我不熟悉 Turbolinks,但总的来说,根据他们的 GitHub 自述文件,“你不能依赖 DOMContentLoaded 或 jQuery.ready() 来触发你的代码”,我认为它严重阻碍了依赖这些的扩展页面加载时运行的事件。

特别是在这种情况下,由于 Turbolinks 替换了正文内容,它破坏了使用 DOM 内容进行操作的 CrossriderAPI 库。因此,如果不对代码进行大量修改,我认为 Turbolinks 不能与 CrossriderAPI 共存,并且可能会因扩展功能而中断。

于 2014-01-19T09:19:20.653 回答