...
SVY-5532, SVY-5523, SVY-5531, SVY-5527 Improved support for JavaScript prototype inside code
Servoy's Script Editor and Build system now have good support for JavaScript prototyping. This allows creating JavaScript objects using prototyping and having proper code completion and builder markers.
Assignment directly Supports both setting an Object as prototype or directly assigning new members to the prototype
Assigning an object as prototype
Deprecated members
Protected members
@extends for public/protected members that are added through by the constructor
IIFE's for setting up the prototype
. Prototype members can be marked as deprecated or protected through JSDoc annotations.
Expand | ||
---|---|---|
| ||
|
SVY-5615 Improved build system to handle special JavaScript methods like function.call, function.apply, function.bind and Object.create
For .apply/call/bind, the build system will recognize that the .apply/call/bind method will return the same type as the function on which it is called, for example:
Code Block |
---|
var x = Object.prototype.toString.call(object) //Build system will know that .call will return a String, as it is called on the .toString() method of Object, which returns a String value function test() { var y = Array.prototype.slice.call(arguments) //Build system will know that y is an Array, as .slice() of Array returns an Array } |
For Object.create(object, properties) the build system will know that what Object.create returns has the same type as the value of the object parameter, enhanced with the (optional) properties (See Object.create for more info)
SVY-5827 support function types with rest parameters in typedefs
Code Block |
---|
/** * @typedef {{ * name: String, * handler: function(String, Number|*...) * }} */ var MyType |
SVY-5371 Support returning an instance of itself inside Constructor functions without warnings being generated
This allows building in a fail-save for Constructor function not being called with the new
keyword
Code Block |
---|
/** * @public * @constructor */ function MyConstructor(name) { if (!(this instanceof MyConstructor)) { //constructor is not called with the 'new' keyword return new MyConstructor(name) } //rest of the constructor logic }; |
...