1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

Added 'close' method

This commit is contained in:
Bryan Roe
2019-10-04 12:32:58 -07:00
parent ba7ef6c942
commit 1ec290f090
2 changed files with 14 additions and 3 deletions

View File

@@ -33,7 +33,9 @@ function windows_notifybar_system(title)
var script = Buffer.from("require('notifybar-desktop')('" + title + "').on('close', function(){process.exit();});").toString('base64');
require('events').EventEmitter.call(ret, true).createEvent('close');
require('events').EventEmitter.call(ret, true)
.createEvent('close')
.addMethod('close', function close() { this.child.kill(); });
console.log('switching');
ret.child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-b64exec', script], { type: 1 });
@@ -55,7 +57,15 @@ function windows_notifybar_local(title)
ret._promise.notifybar = ret;
require('events').EventEmitter.call(ret, true)
.createEvent('close');
.createEvent('close')
.addMethod('close', function close()
{
for (var i in this._pumps)
{
this._pumps[i].removeAllListeners('exit');
this._pumps[i].close();
}
});
ret._promise.then(function (m)
{