I think this question has been asked, but I've searched through Google and here, and still a bit confused on how it works.
I have two scripts, CS1.coffee and CS2.coffee, CS1 is what is loaded with the main page, and has a button on it. When the button is pressed a window appears and CS2 is run. However, I want to refer to variables that exist in CS1 from methods in CS2.
In other terms,
- Main page loads, calls CS1 (which has button logic)
- Button is pressed
- A new KendoWindow appears which calls CS2 (this window displays data that is taken from variables in CS1)
Sample Code:
CS1.coffee
root = export ? this
root.number = 42
$("#winButton").click=->
//new kendoWindow appears, with content being a separate html containing CS2 scripts
root.testFunc =->
alert 'I was called'
CS2.coffee
root = export ? this
answer = root.number
$("#testButton").click =->
root.testFunc