I want to manage part of my layout with coffeescript. I have a left/right panel and I want to be able to switch between them. I have created something like this:
window.switchPanel = (panel = 'left', action = 'toggle') ->
open = (panel) ->
...
close = (panel) ->
...
toggle = (panel) ->
...
My question is, how do I structure this so that I can call open/close/toggle by the action variable and can I use something so that I don't have to pass in the panel to every child function? Perhaps @panel?