Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/himself65/class-callable


https://github.com/himself65/class-callable

Last synced: about 1 month ago
JSON representation

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