Last active
March 12, 2017 17:18
-
-
Save denismaster/b04f5bf3368e54a49747412ddd193a77 to your computer and use it in GitHub Desktop.
TypeScript runtime function decorator.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class DecoratorFactory { | |
public createWithCallback(func: Function, callback: any) { | |
if (!callback || typeof (callback) !== "function") | |
return undefined; | |
return function () { | |
const result = func.apply(this, arguments); // (*) | |
callback(); | |
return result; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment