I'm trying to write a package for the Atom text editor, and in my main class (init.coffee), I have an array inside of my module.exports:
servers: []
I want to access this array from a function in another part of the module.exports, but I'm having trouble.
Function:
stas: () ->
dir = getFilePath()
d = fs.statSync dir
if !d.isDirectory()
dirError dir
else
s = new Server dir
s.init()
@servers.push s
return
I keep getting this error:
Uncaught TypeError: this.servers.push is not a function
I call the function like this:
@events.add atom.commands.add ".tree-view", {
'atom-together:startServer': @stas
'atom-together:startClient': @stac
'atom-together:stopServer': @stos
'atom-together:stopClient': @stoc
}
What is the correct way to call this array in coffeescript?