mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
26 lines
868 B
HTML
26 lines
868 B
HTML
<template name="pkg_coffeescript">
|
|
{{#better_markdown}}
|
|
## `coffeescript`
|
|
|
|
[CoffeeScript](http://coffeescript.org/) is a little language that
|
|
compiles into JavaScript. It provides a simple syntax without lots of
|
|
braces and parentheses. The code compiles one-to-one into the
|
|
equivalent JS, and there is no interpretation at runtime.
|
|
|
|
CoffeeScript is supported on both the client and the server. Files
|
|
ending with `.coffee` or `.litcoffee` are automatically compiled to
|
|
JavaScript.
|
|
|
|
Global variables can be set in CoffeeScript by using `this` (or CoffeeScript's
|
|
`@` shorthand), because at the top level `this` refers to the global namespace
|
|
(`window` on the client and
|
|
[`global`](http://nodejs.org/api/globals.html#globals_global) on the server).
|
|
Thus
|
|
|
|
@myFunction = -> 123
|
|
|
|
at the top level sets the global variable `myFunction`.
|
|
|
|
{{/better_markdown}}
|
|
</template>
|