Skip to content

Instantly share code, notes, and snippets.

@ralfbecher
Created February 6, 2018 16:07
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ralfbecher/b0471767fe45b724c954f404104c8f52 to your computer and use it in GitHub Desktop.
Save ralfbecher/b0471767fe45b724c954f404104c8f52 to your computer and use it in GitHub Desktop.
Qlik Sense Mashup with Enigma.js - the official way
var prefix = window.location.pathname.substr(0, window.location.pathname.toLowerCase().lastIndexOf("/extensions") + 1);
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config({
baseUrl: (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
});
require(['js/qlik'], function (qlik) {
require(['enigma', 'autogenerated/qix/engine-api'], function (enigma, schema) {
var cfg = {
schema: schema,
session: {
host: window.location.hostname,
port: window.location.port || undefined,
prefix: undefined,
unsecure: window.location.protocol !== "https:",
reloadURI: undefined
}
};
enigma.getService('qix', cfg).then(function (qix) {
console.log('Do something!', qix);
qix.global.getDocList().then(function(docs){
console.log(docs);
});
}).catch(function (err) {
console.error('Something went wrong!', err);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment