【问题标题】:Ember.js History with Fullscreen APIEmber.js 历史与全屏 API
【发布时间】:2014-03-24 11:32:24
【问题描述】:

可以通过 Ember.js 使用 History API,只需:

App.Router.reopen
  location: 'history'

但是在全屏操作时,任何 URL 修改都会破坏 Chrome 中的全屏模式(这是众所周知的错误 https://code.google.com/p/chromium/issues/detail?id=171670)。

是否可以在 EmberJS 中对 History API 更改进行排队,并仅在应用退出全屏时触发所有更改?

附:看起来 YouTube 也是如此——您可以全屏观看多个连续视频,并且 URL 保持不变,直到您退出全屏模式。

【问题讨论】:

    标签: javascript html ember.js fullscreen html5-history


    【解决方案1】:

    您可能可以通过重新打开 Ember.HistoryLocation 来做到这一点。我会尝试在全屏时修改方法 pushState 以对路径进行排队。在退出全屏时,使用排队的路径手动调用 pushState 方法。

    Source code for Ember.HistoryLocation

    【讨论】:

    • 谢谢,成功了!我使用自定义 pushState、新属性 pathQueue 和新方法 fireQueue(在我的情况下现在是 screenfull.raw.fullscreenchange 的侦听器)扩展了 Ember.HistoryLocation。之后,我用 App.register 注册了这个新类,用作 App.Router.reopen 中的位置。
    • 很高兴它成功了。你能发布一些代码示例吗?我想还有更多的 Ember 应用可以使用全屏。
    • 当然可以,但是我的解决方案非常具体(我们使用 CoffeeScript 和 screenfull.js)并且丑陋(尽管没有什么比临时更永久的了)。这是我添加到 app.coffee 中的内容 - gist.github.com/vyahhi/9251106
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-25
    • 1970-01-01
    • 1970-01-01
    • 2011-09-08
    • 1970-01-01
    • 2016-01-03
    相关资源
    最近更新 更多