0

Note: The context of this question is javascript, however is generic enough to not tie it as just as a javascript question.

We have a javascript library that needs to send a request using http or https. In order to decide which protocol to use, our library calls a method that decides which protocol should we use. That method is declared in the 'user side of our library' (as a callback?).

For the moment we have named it as isConnectionSecure but we are not asking that but instead the question is more like:

Should we use the secure protocol?

The library is working somehow like:

OurSuperLibrary.api = {
    isConnectionSecure: function () {
        // Do your checks
        return true;
    }
}

var ourLibrary = new OurSuperLibrary();

// Internally, our library will call the previously declared method:
ourLibrary.doRequest();

Thanks.

José Cabo
  • 6,149
  • 3
  • 28
  • 39
  • 1
    `useHttps`? `useSecureConnection`? `shouldUseSecureConnection`? `getProtocol`? – deceze Oct 25 '16 at 10:10
  • We also thought about using *useWhatever*. However we understand that the 'use+Noun' is more like executing an operation. Thanks for your input :) – José Cabo Oct 25 '16 at 10:17
  • 1
    Yeah, if Javascript supported `?` in plain property names, that would be more useful. In that case I tend to do `shouldUseX`. Anyway though, this really isn't a good question for Stack Overflow. There's no "right" answer, only opinions. – deceze Oct 25 '16 at 10:19
  • Thanks for your input! It is very valuable even when it is an opinion. Mind you to point me to the correct 'stackoverfow' site for these kind of questions? – José Cabo Oct 26 '16 at 13:33

0 Answers0