$ -> terminal_container = $('body') term = null socket = io.connect('/') socket.on 'data', (data) -> if term? term.update(data) socket.on 'init', (v) -> term = htmlterm(terminal_container, v.width, v.height) term.update v.text