Comparing version 6.0.4 to 7.0.0
@@ -57,3 +57,5 @@ /** | ||
*/ | ||
static macro<T extends any>(name: string, callback: MacroFn<T, any[], any>): void; | ||
static macro<T extends any, K extends string>(this: { | ||
new (...args: any): T; | ||
}, name: string, callback: GetMacroFn<T, K>): void; | ||
/** | ||
@@ -87,3 +89,5 @@ * Return the existing macro or null if it doesn't exists | ||
*/ | ||
static getter<T extends any = any>(name: string, callback: GetterFn<T, any>, singleton?: boolean): void; | ||
static getter<T extends any, K extends string>(this: { | ||
new (...args: any): T; | ||
}, name: string, callback: GetGetterFn<T, K>, singleton?: boolean): void; | ||
/** | ||
@@ -90,0 +94,0 @@ * Return the existing getter or null if it doesn't exists |
@@ -41,3 +41,4 @@ "use strict"; | ||
static macro(name, callback) { | ||
this.macros[name] = callback; | ||
const self = this; | ||
self.macros[name] = callback; | ||
this.prototype[name] = callback; | ||
@@ -85,3 +86,4 @@ } | ||
: callback; | ||
this.getters[name] = wrappedCallback; | ||
const self = this; | ||
self.getters[name] = wrappedCallback; | ||
Object.defineProperty(this.prototype, name, { | ||
@@ -88,0 +90,0 @@ get: wrappedCallback, |
{ | ||
"name": "macroable", | ||
"version": "6.0.4", | ||
"version": "7.0.0", | ||
"description": "A simple ES6 class that can be extended to provide macros and getters functionality", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13473
219