Autocomplete for own Classes in IDEa detail that matters, but there might be an alternative!
If you were interested in the previous post: https://plus.google.com/104403800912062884925/posts/D5xpGd817fE
and already have experience with the subject, you have noticed that there was a special case used as an example. In the special case we assume a separate API library is included. In the example we recommend to integrate global functions directly into the class library that throw an error in case they are called.
In order to lookup the interface, one has to type in "Dot" if thats the name of the library. In the screenshot attached to this post the name of the class is "Mail". In order to lookup the interface of Mail, just type in Dot. and the autocomplete feature will present a list of possible functions.
Get "getPrivateFunctions" is a meta function, as well as "getLibrary()" so we are sort of "breaking the rules" in order to implement generic functions, it does not take that much time to learn the keys of the generic functions.
We wonder if there might be a better way for library management, that allows us to implement our own service classes. We assume that this is not possible because there are so many different implementation styles for Java Script.
We thought of making our way a recommendation for best practise but hesitate because of the overhead. Compared with the behaviour of the Google Apps Script service classes you will notice the difference.
The constructor of Google Apps Script service classes encapsulates "new".
var x = SpreadsheetApp.getActiveSpreadsheet();
x. will list the API of "Spreadsheet"
And the difference is, you do not have to include "SpreadsheetApp" in order to use the interface of "Spreadsheet", it is part of the IDE's autocomplete "knowledge". How could we achieve the same with our own "Mail" class as the Google Apps Script team achieves with the "Spreadsheet" class?
If you would know the answer, please share it with the community.Providing the solution supports inheritance!