If you want to run it both on node and client you can do something like this
(taken from
http://stackoverflow.com/questions/4214731/coffeescript-global-variables):

root = exports ? @

root.alertMe =(msg) ->
  alert msg

alertMe 'hi there'

The following should actually work too for client side only (not battle
tested here though)

@.alertMe =(msg) ->
  alert msg

It is a matter of personal style I guess




On Fri, May 27, 2011 at 4:03 AM, Martin Wawrusch <[email protected]>wrote:

> you can use
>
> class window.MyClassName or
> window.functionName =
>
> Check out this here: http://coffeescript-seattlejs.heroku.com/
>
> No need to go bare.
>
>
> On Fri, May 27, 2011 at 3:54 AM, Kieran P <[email protected]> wrote:
>
>> +1  This seems to affect functions too, since Coffeescript makes functions
>> into vairables, and those variables aren't available outside of that scope.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> -
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to