Coffeescript, the Facebook JS API and scope?

You're right in thinking that you shouldn't pollute the global namespace. One way to continue having a clean environment (get it :) is to use a class and keep your Facebook specific functions in there.

You're right in thinking that you shouldn't pollute the global namespace. One way to continue having a clean environment (get it :) is to use a class and keep your Facebook specific functions in there. This might help get you started: class MyFacebookApp constructor: -> doSomething: () -> console.

Log "I'm doing something over here. " window. MyFacebookApp = new MyFacebookApp() window.

FbAsyncInit = -> FB. Init appId: fb_app_id status: true cookie: true xfbml: true oauth: true myFacebookApp.doSomething() Good luck!

That's not a scope issue. If you look at the compiled JS, you'll see var doSomething declared at the top of the file. Moreover, doSomething is set to its proper value before window.FBAsyncInit.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions