Coffeescript inline conditionals -


i have piece of coffeescript compiling fine, yet work should.

jquery ($) ->     eventmethod = window.addeventlistener ? "addeventlistener" : "attachevent"     eventer = window[eventmethod]     messageevent = eventmethod == "attachevent" ? "onmessage" : "message"   # listen message child window eventer messageevent, (e) ->     console.log "parent received message!:  #{e.data}"     newheight = e.data     $("#cf-iframe").css("height", newheight) , false 

messageevent undefined or false causing error. please advise of how around this. i'm new coffeescript, loving far.

update: upon further inspection looks me coffeescript not implement ?/: operators, instead favouring if/then/else approach.

you confusing existential operator ? ternary operator, in coffeescript if expression.

eventmethod = if window.addeventlistener "addeventlistener" else "attachevent" 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -