jQuery ($) ->
eventMethod = if window.addEventListener then "addEventListener" else "attachEvent"
eventer = window[eventMethod]
messageEvent = eventMethod == if "attachEvent" then "onmessage" else "message"
# Listen to message from child window
eventer messageEvent, (e) ->
console.log "parent received message!: #{e.data}"
newHeight = e.data
$("#cf-iframe").css("height", newHeight)
, false
作为另一篇文章的后续。我上面的咖啡脚本编译得很好。然而,它并没有表现出应有的行为。它似乎没有正确地将事件侦听器附加到窗口。谁能帮我找出原因?