Skip to content

Instantly share code, notes, and snippets.

@amekusa
Last active July 26, 2021 04:15
Show Gist options
  • Select an option

  • Save amekusa/28c1cecc543c4799c67f1546c08e325f to your computer and use it in GitHub Desktop.

Select an option

Save amekusa/28c1cecc543c4799c67f1546c08e325f to your computer and use it in GitHub Desktop.
/**
* Extensible Function
* @update 2021-07-26
*/
class Callable extends Function {
constructor() {
super('...args', 'return this.__self.__call(...args)');
this.__self = this.bind(this);
return this.__self;
}
/**
* Runs when the instance is called as function.
* Override to implement
*/
__call() {}
}
export default Callable;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment