Function.prototype.setStaticProperty >= 0.1.4
Purpose
Set a static getter property
Syntax
Function#setStaticProperty
(
Stringname
Functiongetter
Functionsetter
);
Parameters
name
- The name to use for the property (defaults to method name)
getter
setter
Examples
Create a new class and add a getter
var Base = Function.inherits(function Base() {});
Base.setStaticProperty(function time() {
return Date.now();
});
console.log(Base.time);>>> 1511983626913
Comments