fix(Shard): extend EventEmitter to be able to emit events (#2112)

This commit is contained in:
SpaceEEC
2017-11-17 08:49:57 +01:00
committed by Schuyler Cebulskie
parent 196cf7652e
commit 6fa4fc532c

View File

@@ -1,4 +1,5 @@
const childProcess = require('child_process'); const childProcess = require('child_process');
const EventEmitter = require('events');
const path = require('path'); const path = require('path');
const Util = require('../util/Util'); const Util = require('../util/Util');
const { Error } = require('../errors'); const { Error } = require('../errors');
@@ -6,13 +7,14 @@ const { Error } = require('../errors');
/** /**
* Represents a Shard spawned by the ShardingManager. * Represents a Shard spawned by the ShardingManager.
*/ */
class Shard { class Shard extends EventEmitter {
/** /**
* @param {ShardingManager} manager Manager that is spawning this shard * @param {ShardingManager} manager Manager that is spawning this shard
* @param {number} id ID of this shard * @param {number} id ID of this shard
* @param {string[]} [args=[]] Command line arguments to pass to the script * @param {string[]} [args=[]] Command line arguments to pass to the script
*/ */
constructor(manager, id, args = []) { constructor(manager, id, args = []) {
super();
/** /**
* Manager that created the shard * Manager that created the shard
* @type {ShardingManager} * @type {ShardingManager}