I’m working on a backbone application.
I’ve structured my models + collections + views in different files.
which means a solution like
function() { // all my code }() doesn’t apply here
I added a namespace e.g
App.ModelName App.Views.ViewName etc.
when I’m within the same namespace. How can I avoid repeating it.
i.e how can I call ModelName when I’m in a function defined in App.Views.ViewName
at the moment I keep repeating the full string i.e App.XXXX
Thanks
You have several choices:
1) Create a local variable in each function:
2) Create a local variable in each file scope:
3) Use the value of
this: