Created
December 2, 2015 01:29
-
-
Save mindspank/ed24854e09b7eae3c57e to your computer and use it in GitHub Desktop.
loop apps with qsocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var qsocks = require('qsocks'); | |
var Promise = require('bluebird'); | |
qsocks.Connect() | |
.then(function(global) { | |
return global.getDocList(); | |
}) | |
.then(function(doclist) { | |
//Map over doclist, limit to 3 connection at a time to not choke the available sockets | |
return Promise.map(doclist, function(d) { | |
return qsocks.Connect({appname: d.qDocId}) | |
.then(function(global) { | |
return global.openDoc(d.qDocId) | |
}) | |
.then(function(app) { | |
//Do something with app, in this case list all objects. | |
return app.getAllInfos(); | |
}) | |
}, {concurrency: 3}) | |
}) | |
.then(function(props) { | |
console.log(props) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment