The security is an important in any app, specially in enterprice apps development with Titanium. Taking in consideration that my app will be consuming services and getting google's API either for maps or ACS services like push notifications. What are the security security measures that any mobile programmer should take into consideration?
Asked
Active
Viewed 101 times
-2
-
3This isn't an object, it's a function. – Etheryte May 04 '15 at 20:01
-
1[Javascript immediately invoked function patterns](http://stackoverflow.com/questions/10984652/javascript-immediately-invoked-function-patterns) – emerson.marini May 04 '15 at 20:02
-
1@Nit In JavaScript, every function is actually an object: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function – gfullam May 04 '15 at 20:07
-
My bad, I did not realize someone already asked the same question. Thank you for the link! – ricardoorellana May 04 '15 at 20:12
-
@gfullam I think it's pretty clear what I mean. – Etheryte May 04 '15 at 20:20
2 Answers
3
xyz(); means "xyz is a function, please run it";
If you're coming from pretty much any other language the thing in javascript where you define variables with
var a = 5;
but can also define functions the same way
var a = function() { return 5; }
is a little tricky.
In the 2nd case, you can say
var b = a();
and b would be equal to 5; because we ran the function which returned 5;
It could say:
var myfunctiondefinition = function () {
var myPrivateVar = 0;
var myPrivateMethod = function (someText) {
console.log(someText);
};
return {
myPublicVar: "foo",
myPublicFunction: function (bar) {
myPrivateVar++;
myPrivateMethod(bar);
}
};
};
var runThatFunction = myfunctiondefinition();
but, if we don't really need to use myfunctiondefinition ever again, we can just slap the () at the end of it at it will 'run' the function right then.

Charlie Wynn
- 921
- 1
- 8
- 22
-
Thank you for the clarification, and you are right that at the beginning it's a little tricky to understand the way JavaScript defines functions as the same way as variables. I just started yesterday with this approach (Module pattern). – ricardoorellana May 05 '15 at 22:56
1
Immediately invoke the function and return its contents to the variable in the assignment statement.
It is an immediately-invoked function expression.

gfullam
- 11,531
- 5
- 50
- 64
-
2This isn't wrong, but I think people (not me btw) downvoted this because the answer doesn't match the question's level of understanding. – Charlie Wynn May 04 '15 at 20:10
-
1@Charlie Wynn Fair enough. Thanks for taking the time to anticipate that I was asking myself why it was downvoted. – gfullam May 04 '15 at 20:12
-
1Yeah, people are weird on here about that sometimes.. Answers that under or overestimate the asker's understanding get boned no matter how right they are. I actually thought my answer was too 'childish' and wouldn't do well! but you can never tell on here sometimes :) – Charlie Wynn May 04 '15 at 20:15
-
1I typically leave tl;dr-susceptible answers, so I was trying to exercise my ability to give a short answer. I may also have been blinded by the desire to be the first to post an answer :-b Lesson learned. – gfullam May 04 '15 at 20:21