Hi,
I am trying to get all the jsdoc into my solution.
I do not understand the following issue :
I create a new object and then call a function from that
var circle1
circle1 = new scopes.sw2013.circle(10,'circle1')
var Area = circle1.getArea()
No jsdoc warnings
No I use a form variable for circle1 ( media)
forms.tst1.circle1 = new scopes.sw2013.circle(10,'circle1')
var Area = forms.tst1.circle1.getArea()
now the second line gives a jsdoc warning
the method getArea is undefined for object circle1
How can I get rid of this warning ?
You need to type you form variable. Something like
@type {scopes.sw2013.circle}
Thanks Patrick,
Tried this, but no change
what does your circle class look like?
It is just an example, but I want to use this object stuff in my solutions
/**
* @constructor
* @param {Number} radius
* @param {String} name
* @properties={typeid:24,uuid:"8C416079-AE2E-41D8-A5A3-199B2B018791"}
*/
function circle(radius,name) {
/**
* Internal Radius
* @private // not really needed
* @type {Number}
*/
var r=radius // this.r maakt het mofgelujk om in de aanroep circle2.r=40 te gebruiken maar dat breekt encapsolution
/**
* Internal Name
* @private // not really needed
* @type {String}
*/
var cname=name
/**
* Listeners array
* @type {Array<Function>}
*/
var listeners = new Array();
/**
* set the name of the object
* @public
* @return {String}
*/
this.getName = function(){
return name
}
/**
* get omtrek
* @public
* @return {Number}
*/
this.getArea = function(){
return Math.PI*Math.pow(r,2);
}
/**
* get circumference
* @public
* @return {Number}
*/
this.getCircumfrence = function(){
return 2*Math.PI*r;
}
/**
* get radius
* @public
* @return {Number}
*/
this.getRadius = function(){
return r;
}
/**
* @public
* @param {Number} newValue
*/
this.setRadius = function(newValue){
var oldValue = r;
r = newValue;
for (var i in listeners){
listeners[i].apply(this,[cname,oldValue,newValue]); //apply or call
}
}
/**
* @public
* @param {Function} listener
*/
this.addChangeListener = function(listener){
listeners.push(listener)
}
}