@sensslen/node-gamepad 1.0.3-beta.4 → 1.0.3-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NodeGamepad.d.ts CHANGED
@@ -22,7 +22,7 @@ export declare class NodeGamepad extends EventEmitter {
22
22
  private log;
23
23
  private connect;
24
24
  private stopConnectionProcess;
25
- private registerStopProgramStopEvent;
25
+ private registerProgramExitEvents;
26
26
  private disconnect;
27
27
  private toIDeviceSpec;
28
28
  private onControllerFrame;
package/NodeGamepad.js CHANGED
@@ -25,6 +25,7 @@ var NodeGamepad = /** @class */ (function (_super) {
25
25
  var _this = _super.call(this) || this;
26
26
  _this.config = config;
27
27
  _this.logger = logger;
28
+ _this._usb = undefined;
28
29
  _this._stopped = false;
29
30
  _this._joystickStates = {};
30
31
  _this._buttonStates = {};
@@ -34,12 +35,9 @@ var NodeGamepad = /** @class */ (function (_super) {
34
35
  return _this;
35
36
  }
36
37
  NodeGamepad.prototype.start = function () {
37
- var _this = this;
38
38
  this.log("Starting connection procedure to device:" + JSON.stringify(this.toIDeviceSpec(this.config)));
39
- this.registerStopProgramStopEvent();
39
+ this.registerProgramExitEvents();
40
40
  this.connect();
41
- // on process exit, disconnect from any devices we may be connected to. and also stop any connection procedure
42
- process.on('exit', function () { return _this.stop(); });
43
41
  };
44
42
  NodeGamepad.prototype.stop = function () {
45
43
  if (!this._stopped) {
@@ -111,11 +109,9 @@ var NodeGamepad = /** @class */ (function (_super) {
111
109
  this._connectRetryTimeout = undefined;
112
110
  }
113
111
  };
114
- NodeGamepad.prototype.registerStopProgramStopEvent = function () {
112
+ NodeGamepad.prototype.registerProgramExitEvents = function () {
115
113
  var _this = this;
116
- process.on('SIGINT', function () { return _this.stop(); });
117
114
  process.on('exit', function () { return _this.stop(); });
118
- process.on('uncaughtException', function () { return _this.stop(); });
119
115
  };
120
116
  NodeGamepad.prototype.disconnect = function () {
121
117
  if (this._usb) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sensslen/node-gamepad",
3
- "version": "1.0.3-beta.4",
3
+ "version": "1.0.3-beta.8",
4
4
  "description": "node-gamepad is a package for node that allows you to effortlessly interface your node applications with a variety of gamepad controllers. This is a port of node-gamepad library to typescript by also removing some of the restrictions implied by this library (namely allowing gamepads to be subcleassed and also improving usb interaction)",
5
5
  "homepage": "https://github.com/sensslen/node-gamepad",
6
6
  "bugs": {