Define Static Method
Define Static Method is a simple utility for defining a static method in ES5 with the same property descriptor as an ES2015 class method.
Install
Install with npm:
npm install --save define-static-method
Usage
In ES2015, we might do this:
{ thisname = name; } static { return 'Vladimir'; }
In ES5, we can do this:
var defineStatic = ; { thisname = name;} ;
And here is Vladimir:
Squidname; // -> 'Vladimir'
API
defineStaticMethod(constructor, prop, method)
Param | Type | Description |
---|---|---|
constructor | function |
The constructor function the method will be added to |
prop | string |
The property name of the method |
method | function |
The static method to add |
License
Copyright © 2016 Akim McMath. Licensed under the MIT License.