-2

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?

ricardoorellana
  • 2,270
  • 21
  • 35

2 Answers2

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
  • 2
    This 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
  • 1
    Yeah, 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
  • 1
    I 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