V
V
Vyacheslav Lebedev2015-04-19 20:40:11
CoffeeScript
Vyacheslav Lebedev, 2015-04-19 20:40:11

Function scope of compiled coffeeScript file?

Good evening!
As you know, coffe, after compiling, creates a local scope for each function and for each file in which I need to have access to functions. I paste the files. But since all functions have a local scope, there are difficulties in using these functions.
So here's the question. How do I write in cs, some function names to the global scope and is it possible to do it in coffeescript?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Shikanov, 2015-04-19
@slavikse

Assign a function to an attribute of the window object:

window.hello_world = ()->
    console.log "Hello World"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question