Add an optional callback for Integration.initPipe(). Addresses #2031
This commit is contained in:
parent
52932b6eb0
commit
ffab4d5243
1 changed files with 3 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue