Do you know any IDE that can autofill this kind of code?
I have a javascript class generator here:
(function() {
var core = {
bind : function(method, scope) {
if (!( method instanceof Function))
throw new TypeError("Function needed as method.");
if ( typeof (scope) != "object")
throw new TypeError("Object needed as scope.");
return function() {
return method.apply(scope, arguments);
};
},
require : function(source) {
if ( typeof (source) != "object" || !source)
throw new TypeError("Object needed as source.");
for (var property in source)
if (source.hasOwnProperty(property) && !this.prototype.hasOwnProperty(property))
this.prototype[property] = source[property];
},
override : function(source) {
if ( typeof (source) != "object" || !source)
throw new TypeError("Object needed as source.");
for (var property in source)
if (source.hasOwnProperty(property))
this.prototype[property] = source[property];
},
extend : function(source) {
var superClass = this;
var newClass = source.hasOwnProperty("constructor") ? source.constructor : function() {
superClass.apply(this, arguments);
};
newClass.superClass = superClass;
var superClone = function() {
};
superClone.prototype = superClass.prototype;
newClass.prototype = new superClone();
newClass.prototype.constructor = newClass;
if (source)
newClass.override(source);
return newClass;
}
};
core.require.call(Function, core);
Function.create = function (source){
var newClass = source.hasOwnProperty("constructor") ? source.constructor : function() {};
newClass.override(source);
return newClass;
};
})();
I need to complete the code (written in the comments) for these classes:
var A = Function.create({
test: function (){
console.log("a");
}
});
var B = A.extend({
test: function (){
console.log("b");
},
test2: function (){
console.log("b2");
}
});
var F = Function.create({
getA: function (){
return new A();
},
getB: function (){
return new B();
}
});
var f = new F();
var a = f.getA();
var b = f.getB();
a.test();
b.test();
b.test2();
, IDE - , Function.prototype, Function, . , jsdoc, , , , . IDE, js-, , . (, , , ).
IDE ( )?