下記コードではtimerという関数をグローバルオブジェクト化している。
root = exports ? this
root.timer = window.setInterval(
->
dat = new Date()
document.getElementById('result').innerHTML = dat.toLocaleTimeString()
1000
)
window.onload = timer
下記コードではprocessという関数をグローバルオブジェクト化している。
root = exports ? this
root.process = ->
name = document.fm.name.value
alert('こんにちは、' + name + 'さん!')
false