我正在努力在coffeescript中重新制作这样的功能,有人会帮我一点。
// Listen to message from child window
eventer(messageEvent,function(e) {
console.log('parent received message!: ',e.data);
},false);
答案 0 :(得分:2)
您的代码转换为CoffeeScript中的等效代码:
# Listen to message from child window
eventer messageEvent, ((e) ->
console.log "parent received message!: ", e.data
), false
如果您需要有关JavaScript代码的CoffeeScript等效性的帮助,将来可以随时使用此工具:
答案 1 :(得分:0)
# Listen to message from child window
eventer messageEvent, (e) ->
console.log "parent received message!: #{e.data}"
, false
使用Verified的沙盒CoffeeScript编译器