var segmentProvider = {
name: "segmentProvider",
version: "1.0.0",
timeout: 1000,
callback: null,
provider: function (callback, params) {
...
It is important that your API request is also ready before the callback is called.
With the XMLHttpRequest this is for example onreadyst...