var apiKey_Key = "apiKey";
var baseURL_Key = "baseURL";
var indicatorDescriptionID_Key = "indicatorDescriptionID";
var api = null;
var map = null;
function run() {
var apiKey = $("#apiKey").val();
var baseURL = $("#baseURL").val();
$("#runButton").attr("disabled", "disabled");
//Create an API instance against which to make your API calls, passing in your API key.
api = new hiw.API(apiKey, baseURL);
runExample();
}
function runExample() {
var synchronizer = new hiw.Synchronizer();
var localesLI = $("#getLocales");
var timeframesLI = $("#getTimeframes");
var indicatorDescriptionsLI = $("#getIndicatorDescriptions");
var overallStatusLI = $("#overallStatus");
// Indicate the process has started.
processing(overallStatusLI);
// Get locales.
processing(localesLI);
synchronizer.add(hiw.Locale.getAll(api, function (result) {
done(localesLI);
}));
// Get timeframes.
processing(timeframesLI);
synchronizer.add(hiw.Timeframe.getAll(api, function (result) {
done(timeframesLI);
}));
// Get indicator descriptions.
processing(indicatorDescriptionsLI);
synchronizer.add(hiw.IndicatorDescription.getAll(api, function (result) {
done(indicatorDescriptionsLI);
}));
// This delegate function will run after all Asyncs have completed.
synchronizer.sync(function () {
done(overallStatusLI);
runComplete();
});
}}
function runComplete() {
$("#runButton").removeAttr("disabled");
}
function processing($target) {
$target.attr("class", "processing");
}
function done($target) {
$target.attr("class", "done");
}
function getParameters() {
var apiKey = null;
var baseURL = null;
if (typeof (Storage) !== "undefined") {
apiKey = localStorage.getItem(apiKey_Key);
baseURL = localStorage.getItem(baseURL_Key);
}
$("#apiKey").val(apiKey);
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.