So, the first question I could not find the answer to. Could be enough reason to ask your first question. Sorry if the answer can be found outside the backbone.js area.
In the backbone.js application, I need to have access to several variables in different functions, so I need to use some global variable settings.
I am wondering if my current solution / good practice is acceptable. My IDE (IDEA) seems like this is not the case:
var MyModel = Backbone.Model.extend({
initialize:function(){
var myGlobalVar, myOtherGlobalVar;
},
myFunction:function() {
myGlobalVar = value;
model.set({"mrJson": {"email": myGlobalVar}});
model.save();
});
}
},
myOtherFunction:function() {
myOtherGlobalVar = otherValue;
model.set({"mrJson": {"email": myGlobalVar, "other": myOtherGlobalVar}});
model.save();
});
}
}
}
I tried to declare implicitly declared global variables, but this led to the fact that they were not accessible from this function.
Is there a way to handle these global variables in backbone.js?
source
share