Last active
September 20, 2015 17:01
-
-
Save mindspank/6b18348dc8535029ab52 to your computer and use it in GitHub Desktop.
qsocks - sample
This file contains 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
//Require the module | |
var qsocks = require('qsocks'); | |
//For Qlik Sense Desktop | |
//You have two different entry points, the global handle or connect directly to an app. | |
//The entire Engine API is async and managed through promises in this module. | |
//Global | |
//Connecting to the Engine, once connected returns the handle for global. | |
qsocks.Connect().then(function(global) { | |
//We now have a global handle and can execute functions using it. | |
global.getDocList().then(function(list) { | |
console.dir(list) | |
}); | |
global.oSVersion().then(function(version) { | |
console.log(version); | |
}) | |
//We can also open a app, this returns a new handle. | |
//With that handle we can interact with the app. | |
global.openDoc('Helpdesk Management').then(function(app) { | |
//Create a variable | |
app.createVariable('MyNewVariable').then(function(reply) { | |
console.log(reply) //true or false | |
}); | |
}) | |
}); | |
//If you know which app you want to connect to you can connect to it directly instead of going through the global handle. | |
qsocks.Connect({appname: 'Helpdesk Management'}).then(function(app) { | |
//do stuff with app. | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment