Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
3b1ee6460f | |||
1f86bb0eb4 | |||
463b4db091 | |||
66f463549d |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartipc",
|
"name": "@pushrocks/smartipc",
|
||||||
"version": "1.0.6",
|
"version": "1.0.8",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartipc",
|
"name": "@pushrocks/smartipc",
|
||||||
"version": "1.0.6",
|
"version": "1.0.8",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "node inter process communication",
|
"description": "node inter process communication",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -31,9 +31,11 @@ tap.test('should create a client', async tools => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should terminate the smartipc process', async tools => {
|
tap.test('should terminate the smartipc process', async tools => {
|
||||||
await tools.delayFor(1000);
|
|
||||||
await clientIpc.stop();
|
await clientIpc.stop();
|
||||||
await serverIpc.stop();
|
await serverIpc.stop();
|
||||||
|
tools.delayFor(2000).then(() => {
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
11
ts/index.ts
11
ts/index.ts
@ -53,7 +53,7 @@ export class SmartIpc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const handler of this.handlers) {
|
for (const handler of this.handlers) {
|
||||||
ipcEventEmitter.on(handler.keyword, (dataArg) => {
|
ipcEventEmitter.on(handler.keyword, dataArg => {
|
||||||
handler.handlerFunc(dataArg);
|
handler.handlerFunc(dataArg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -65,14 +65,11 @@ export class SmartIpc {
|
|||||||
public async stop() {
|
public async stop() {
|
||||||
switch (this.options.type) {
|
switch (this.options.type) {
|
||||||
case 'server':
|
case 'server':
|
||||||
this.ipc.server.stop();
|
this.ipc.server.stop();
|
||||||
break;
|
break;
|
||||||
case 'client':
|
case 'client':
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
plugins.smartdelay.delayFor(2000).then(() => {
|
|
||||||
process.exit(0);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user