New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-nfcpy-id

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-nfcpy-id - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

.eslintrc

143

index.js

@@ -1,3 +0,1 @@

'use strict';
const EventEmitter = require('events').EventEmitter;

@@ -7,91 +5,90 @@ const PythonShell = require('python-shell');

module.exports = class extends EventEmitter {
constructor(options) {
super();
this._options = options;
this._mode = 'mode' in (options || {}) ? options.mode : 'loop';
this._running = false;
this._exiting = false;
this._firstLaunch = false;
constructor(options) {
super();
this._options = options;
this._mode = 'mode' in (options || {}) ? options.mode : 'loop';
this._running = false;
this._exiting = false;
this._firstLaunch = false;
if (this._mode === 'non-loop') {
this._loop = false;
this._non_touchend = false;
} else if (this._mode === 'non-touchend') {
this._loop = false;
this._non_touchend = true;
} else {
this._loop = true;
this._non_touchend = false;
}
if (this._mode === 'non-loop') {
this._loop = false;
this._non_touchend = false;
} else if (this._mode === 'non-touchend') {
this._loop = false;
this._non_touchend = true;
} else {
this._loop = true;
this._non_touchend = false;
}
['SIGHUP', 'SIGINT', 'exit'].forEach((event) => {
process.on(event, () => {
if (this._firstLaunch) {
this._exiting = true;
this.sendSignal('SIGHUP');
console.log("aaaaaa");
}
});
['SIGHUP', 'SIGINT', 'exit'].forEach((event) => {
process.on(event, () => {
if (this._firstLaunch) {
this._exiting = true;
this.sendSignal('SIGHUP');
}
});
});
return this;
}
return this;
}
get isRunning() {
return this._running;
}
get isRunning() {
return this._running;
}
once() {
const scriptFile = 'scriptFile' in (this._options || {}) ?
this._options.scriptFile : 'reader.py';
const scriptPath = 'scriptPath' in (this._options || {}) ?
this._options.scriptPath : __dirname;
const args = [this._mode];
this.pyshell = new PythonShell(scriptFile, {scriptPath, args}, {mode: 'JSON'});
once() {
const scriptFile = 'scriptFile' in (this._options || {}) ?
this._options.scriptFile : 'reader.py';
const scriptPath = 'scriptPath' in (this._options || {}) ?
this._options.scriptPath : __dirname;
const args = [this._mode];
this.pyshell = new PythonShell(scriptFile, { scriptPath, args }, { mode: 'JSON' });
this.pyshell.stdout.on('data', (json) => {
if (this.isRunning) {
const data = JSON.parse(json.split('\n')[0]);
this._running = this._loop || !this._non_touchend && !(data.event === 'touchend');
this.emit(data.event, data);
}
});
this.pyshell.end((err) => {
if (!this._exiting) {
this._running = false;
this._firstLaunch = false;
this.emit('error', err);
}
});
}
start() {
this.pyshell.stdout.on('data', (json) => {
if (this.isRunning) {
return this;
const data = JSON.parse(json.split('\n')[0]);
this._running = this._loop || (!this._non_touchend && !(data.event === 'touchend'));
this.emit(data.event, data);
}
this._running = true;
});
if (!this._firstLaunch) {
this.once();
this._firstLaunch = true;
} else {
this.sendSignal('SIGCHLD');
this.pyshell.end((err) => {
if (!this._exiting) {
this._running = false;
this._firstLaunch = false;
this.emit('error', err);
}
});
}
start() {
if (this.isRunning) {
return this;
}
this._running = true;
pause() {
if (!this.isRunning) {
return this;
}
this._running = false;
if (!this._firstLaunch) {
this.once();
this._firstLaunch = true;
} else {
this.sendSignal('SIGCHLD');
}
return this;
}
pause() {
if (!this.isRunning) {
return this;
}
this._running = false;
this.sendSignal('SIGCHLD');
return this;
}
sendSignal(signal) {
this.pyshell.childProcess.kill(signal);
}
}
sendSignal(signal) {
this.pyshell.childProcess.kill(signal);
}
};
{
"name": "node-nfcpy-id",
"version": "0.0.5",
"version": "0.0.6",
"description": "Read the ID of an NFC Tag with nfcpy",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"lint": "eslint ./"
},

@@ -26,4 +26,9 @@ "repository": {

"babel-cli": "^6.24.1",
"babel-preset-es2015": "^6.24.1"
"babel-preset-es2015": "^6.24.1",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.1",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-jsx-a11y": "^5.0.3",
"eslint-plugin-react": "^7.0.1"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc