Jsdoc and object

Questions, tips and tricks and techniques for scripting in Servoy

Jsdoc and object

Postby Hans Nieuwenhuis » Sun Jun 16, 2013 3:35 pm

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
Code: Select all
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)
Code: Select all
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 ?
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: Jsdoc and object

Postby patrick » Mon Jun 17, 2013 12:15 pm

You need to type you form variable. Something like

@type {scopes.sw2013.circle}
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Jsdoc and object

Postby Hans Nieuwenhuis » Mon Jun 17, 2013 9:37 pm

Thanks Patrick,

Tried this, but no change
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: Jsdoc and object

Postby mboegem » Tue Jun 18, 2013 12:12 am

what does your circle class look like?
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Jsdoc and object

Postby Hans Nieuwenhuis » Tue Jun 18, 2013 7:15 am

It is just an example, but I want to use this object stuff in my solutions

Code: Select all
/**
* @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)
   }
}
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 9 guests