From ffab4d5243cc0041153e5a9c0d8c3224625fca69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Mon, 12 Apr 2021 12:35:51 +0300 Subject: [PATCH] Add an optional callback for Integration.initPipe(). Addresses #2031 --- chrome/content/zotero/xpcom/integration.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index e456b8cc38..c9db25acee 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -77,10 +77,12 @@ Zotero.Integration = new function() { /** * Begin listening for integration commands on the given pipe * @param {String} pipe The path to the pipe + * @param {Function} callback The callback to call on pipe read */ - this.initPipe = function(pipe) { + this.initPipe = function (pipe, callback) { Zotero.IPC.Pipe.initPipeListener(pipe, function(string) { if(string != "") { + if (typeof callback == 'function') callback(string); // exec command if possible var parts = string.match(/^([^ \n]*) ([^ \n]*) (\/[^\n\\]*\/)(?: ([^ \n]*))?\n?$/); if(parts) {