Function.prototype.setStaticProperty >= 0.1.4

Purpose

Set a static getter property

Description


Syntax

Function#setStaticProperty ( StringnameFunctiongetterFunctionsetter );

Parameters

name

The name to use for the property (defaults to method name)

getter

setter

Return values

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