Properties

Properties vs Functions vs Fields

Properties in the .NET Framework are referred to as members of a class that can be written as a “field” with getter and setter accessing functions automatically generated. Rather than creating getValue and setValue functions, AwesomeScript uses the JavaScript feature of all parameters being variadic. Properties are functions that will return the value of something when no parameters are passed and will set the value of something when a parameter is passed. Examples are:

   1:  $Anchor.Href(); // returns the href
   2:  $Anchor.Href("http://awesomescript.codeplex.com"); // sets the href

In the first example, multiple properties are set with one line of code. In the second example, the properties are set and since the calling element is returned, the variable “a” is assigned the resulting anchor for later use.

Property chaining is supported in the latest version of the Awesome-vsdoc.js Intellisense support. Beware that property chaining is supported for elements and their properties, but members such as events (OnClick, OnCollapsed) and fields (Classes) will not return the calling elements for chaining.

Last edited Jan 5, 2011 at 8:49 PM by dahrkdaiz, version 2

Comments

No comments yet.