Created
February 6, 2018 16:07
-
-
Save ralfbecher/b0471767fe45b724c954f404104c8f52 to your computer and use it in GitHub Desktop.
Qlik Sense Mashup with Enigma.js - the official way
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 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