Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/himself65/class-callable
https://github.com/himself65/class-callable
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/himself65/class-callable
- Owner: himself65
- Created: 2019-06-28T04:24:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T01:20:59.000Z (almost 2 years ago)
- Last Synced: 2024-10-02T08:49:54.362Z (3 months ago)
- Language: JavaScript
- Size: 527 KB
- Stars: 8
- Watchers: 0
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# class-callable
> make class callable
[![npm version](https://badge.fury.io/js/class-callable.svg)](https://badge.fury.io/js/class-callable)
[![Build Status](https://www.travis-ci.com/Himself65/callable-class.svg?branch=master)](https://www.travis-ci.com/Himself65/class-callable)## USAGE
```bash
yarn add class-callable
``````js
class A extends Callable {
constructor (props) {
super('__call__')
}__call__ () {
return 'called'
}
}class B extends Callable {
__call__ () {
return 'called'
}
}class C extends Callable {
constructor () {
super(function () {
return 'called'
})
}
}const a = new A()
a()
// 'called'
const b = new B()
b()
// 'called'
const c = new C()
c()
// 'called'
```## LICENSE
Follow [MIT](LICENSE) LICENSE