Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
753 bytes
|
Line | |
---|
1 | if (typeof Object.create === 'function') {
|
---|
2 | // implementation from standard node.js 'util' module
|
---|
3 | module.exports = function inherits(ctor, superCtor) {
|
---|
4 | if (superCtor) {
|
---|
5 | ctor.super_ = superCtor
|
---|
6 | ctor.prototype = Object.create(superCtor.prototype, {
|
---|
7 | constructor: {
|
---|
8 | value: ctor,
|
---|
9 | enumerable: false,
|
---|
10 | writable: true,
|
---|
11 | configurable: true
|
---|
12 | }
|
---|
13 | })
|
---|
14 | }
|
---|
15 | };
|
---|
16 | } else {
|
---|
17 | // old school shim for old browsers
|
---|
18 | module.exports = function inherits(ctor, superCtor) {
|
---|
19 | if (superCtor) {
|
---|
20 | ctor.super_ = superCtor
|
---|
21 | var TempCtor = function () {}
|
---|
22 | TempCtor.prototype = superCtor.prototype
|
---|
23 | ctor.prototype = new TempCtor()
|
---|
24 | ctor.prototype.constructor = ctor
|
---|
25 | }
|
---|
26 | }
|
---|
27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.