.
Size: a a a
.
DE
javascript
class NewPull extends Pull {
end () {
this.redis.end(false);
this.push(null);
}
}
const newPull = new NewPull();
newPull.end();
S
javascript
class NewPull extends Pull {
end () {
this.redis.end(false);
this.push(null);
}
}
const newPull = new NewPull();
newPull.end();

К
javascript
class NewPull extends Pull {
end () {
this.redis.end(false);
this.push(null);
}
}
const newPull = new NewPull();
newPull.end();
DE
javascript
class Pull {
constructor (queue, redisClient, onTimeout, timeout){
Readable.call(this, { objectMode: true });
this.queue = queue;
this.redis = redisClient;
this.onTimeout = onTimeout || function () {};
this.timeout = timeout || 10;
this.idle = (this.timeout + (5 + Math.random() * (25 - 5) | 0)) * 1000;
}
get () {
this.redis.on("error", (err) => {
this.emit("error", err);
});
}
end () {
this.redis.end(false);
this.push(null);
}
}
module.exports = Pull;
S
javascript
class Pull {
constructor (queue, redisClient, onTimeout, timeout){
Readable.call(this, { objectMode: true });
this.queue = queue;
this.redis = redisClient;
this.onTimeout = onTimeout || function () {};
this.timeout = timeout || 10;
this.idle = (this.timeout + (5 + Math.random() * (25 - 5) | 0)) * 1000;
}
get () {
this.redis.on("error", (err) => {
this.emit("error", err);
});
}
end () {
this.redis.end(false);
this.push(null);
}
}
module.exports = Pull;

.
javascript
class Pull {
constructor (queue, redisClient, onTimeout, timeout){
Readable.call(this, { objectMode: true });
this.queue = queue;
this.redis = redisClient;
this.onTimeout = onTimeout || function () {};
this.timeout = timeout || 10;
this.idle = (this.timeout + (5 + Math.random() * (25 - 5) | 0)) * 1000;
}
get () {
this.redis.on("error", (err) => {
this.emit("error", err);
});
}
end () {
this.redis.end(false);
this.push(null);
}
}
module.exports = Pull;
DE
.
DE
.
DE
DE
javascript
const Singleton = (function() {
let instance;
// Приватные методы и свойства
// Конструктор
function Singleton() {
if (instance) return instance;
instance = this;
}
// Публичные методы
Singleton.prototype.test = function() {};
return Singleton;
})();
console.log(new Singleton() === new Singleton());
S
javascript
const Singleton = (function() {
let instance;
// Приватные методы и свойства
// Конструктор
function Singleton() {
if (instance) return instance;
instance = this;
}
// Публичные методы
Singleton.prototype.test = function() {};
return Singleton;
})();
console.log(new Singleton() === new Singleton());

DE
DE
.
javascript
class Pull {
constructor (queue, redisClient, onTimeout, timeout){
Readable.call(this, { objectMode: true });
this.queue = queue;
this.redis = redisClient;
this.onTimeout = onTimeout || function () {};
this.timeout = timeout || 10;
this.idle = (this.timeout + (5 + Math.random() * (25 - 5) | 0)) * 1000;
}
get () {
this.redis.on("error", (err) => {
this.emit("error", err);
});
}
end () {
this.redis.end(false);
this.push(null);
}
}
module.exports = Pull;
DE
.
extendsDE
javascript
class A {
constructor (c) {
this.c = c
}
b () {
return this.c
}
}
javascript
const A = function (c) {
this.c = c
}
A.prototype.b = function () {
return this.c
}