Function.prototype.setMethod >= 0.1.3
Purpose
Set a prototype method on the this class
Syntax
Function#setMethod
(
Stringname
Functionmethod
);
Parameters
name
- The given function name is used by default
method
Return values
Function
The same method is returned
Examples
Create a new class and set a method
var Base = Function.inherits(function Base() {});
Base.setMethod(function doSomething() {
return 'this is something';
});
var instance = new Base();
instance.doSomething();>>> "this is something"
Comments