victor.rojo:
So is it possible to create a new type Person and don´t have to write the object definition? @param {Person} pPerson ?
Pls. read my post on the @return, this will work for the object you want.
Example of the function creating the object.
/**
* @param {String} id
* @return {Object}
*/
function getPerson(id)
{
// the 'id' param maybe used to look up the person...
var _p = new Object();
_p.name = 'Marc';
_p.age = 38;
return _p;
}
Example of the calling method:
function myMethod()
{
var _p1 = globals.getPerson('abc');
}
you will see that the _p1 variable in de calling method now has autocompletion on ‘name’ and ‘age’.
In this case I have warnings about the property name and the function are undefined. I can change the param tag to “@param {{name:String, isParent:Boolean, …}} pPerson” but I will have to do it for each function and every time I modify the object.
victor.rojo:
In this case I have warnings about the property name and the function are undefined. I can change the param tag to “@param {{name:String, isParent:Boolean, …}} pPerson” but I will have to do it for each function and every time I modify the object.
I don’t know another way of achieving what you want.
But can’t you re-structure the method?
Just pass the ID of the record, call the function as I explained and return the object…
function Person() {
this.name = "";
this.isParent = false;
}
/**
* @param {Person} person
*/
function myFunction(person) {
}
the only thing is that that works fine in the same scope like globals file or a form file
but if that object has to work over multiply files and scopes it s a bit tricky currently to mix them.
(stuff like {globals.Person} ) but then the return types also must specify that and so on, thats not fully supported yet)