Skip to content

Instantly share code, notes, and snippets.

@mindspank
Created May 7, 2015 21:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindspank/905294636006b3b530a0 to your computer and use it in GitHub Desktop.
Save mindspank/905294636006b3b530a0 to your computer and use it in GitHub Desktop.
Leverage qsocks from within a mashup
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://sense-demo.qlik.com/resources/autogenerated/qlikui.css">
<link rel="stylesheet" href="https://sense-demo.qlik.com/resources/assets/client/client.css" media="all">
<script src="https://sense-demo.qlik.com/resources/js/external/requirejs/require.js"></script>
<script src="js/index.js"></script>
</head>
<body>
<button>Clear Selections with qSocks</button>
<div id="chart" style="width: 400px;height: 400px;"></div>
</body>
</html>
var me = {
config: {
host: 'sense-demo.qlik.com',
prefix: "/",
port: 443,
isSecure: true,
appname: 'a19163d6-1247-4795-a896-a4203cc44226'
},
baseurl: 'https://sense-demo.qlik.com/resources'
};
require.config({
baseUrl: me.baseurl,
paths: {
qsocks: 'https://rawgit.com/mindspank/qsocks/master/qsocks.bundle'
}
});
require(['jquery', 'js/qlik', 'qsocks'], function($, qlik, qsocks) {
app = qlik.openApp('a19163d6-1247-4795-a896-a4203cc44226', me.config);
qsocks.Connect(me.config).then(function(global) {
global.getActiveDoc().then(function(apphandle) {
$('button').on('click', function() {
apphandle.clearAll();
})
})
})
app.getObject('chart', 'zJNVdkm')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment