rsuite-theme
Version:
The suite theme for pagurian
67 lines (40 loc) • 1.5 kB
Markdown
Create a custom constructor which can be modified without affecting the
original class.
[][npm-install]:
```bash
npm install unherit
```
```js
var EventEmitter = require('events').EventEmitter;
/* Create a private class which acts just like
* `EventEmitter`. */
var Emitter = unherit(EventEmitter);
Emitter.prototype.defaultMaxListeners = 0;
/* Now, all instances of `Emitter` have no maximum
* listeners, without affecting other `EventEmitter`s. */
assert(new Emitter().defaultMaxListeners === 0); // true
assert(new EventEmitter().defaultMaxListeners === undefined); // true
assert(new Emitter() instanceof EventEmitter); // true
```
Create a custom constructor which can be modified without affecting the
original class.
* `Super` (`Function`) — Super-class.
`Function` — Constructor acting like `Super`, which can be modified
without affecting the original class.
[][license] © [Titus Wormer][author]
<!-- Definitions -->
[]: https://img.shields.io/travis/wooorm/unherit.svg
[]: https://travis-ci.org/wooorm/unherit
[]: https://img.shields.io/codecov/c/github/wooorm/unherit.svg
[]: https://codecov.io/github/wooorm/unherit
[]: https://docs.npmjs.com/cli/install
[]: LICENSE
[]: http://wooorm.com