【问题标题】:How can I find the events that can be triggered from tvml DOM?如何找到可以从 tvml DOM 触发的事件?
【发布时间】:2015-11-20 07:50:57
【问题描述】:

来自Beginning tvOS Development with TVML Tutorial

向 DOM 添加事件时我很困惑。在这段代码中

App.onLaunch = function(options) {
  //...
  //inside resourceLoader.loadResource...
  var doc = Presenter.makeDocument(resource);
  doc.addEventListener("select", Presenter.load.bind(Presenter)); //add this line
  Presenter.pushDocument(doc);
  //...
}

"select" 来自哪里?

我怎么知道"select" 事件可以从某些元素(例如按钮)中触发?

有这方面的文件吗?

【问题讨论】:

    标签: tvos tvml tvjs


    【解决方案1】:

    我找到了答案。根据TVML Catalog: Using TVML Templates示例代码:

    有关可用事件的完整列表,请参阅 TVMLKit DOM 文档。


    搜索了一会,在TVViewElement Class Reference找到了TVElementEventType

    enum TVElementEventType : Int {
        case Play
        case Select
        case HoldSelect
        case Highlight
        case Change
    }
    

    这些是可以从 tvml 元素触发的事件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-14
      • 2012-12-13
      相关资源
      最近更新 更多