Skip to content

Commit

Permalink
work on Caleydo/caleydo_web_container/#86 switch to es6 promises and …
Browse files Browse the repository at this point in the history
…extract the ajax impl to an own plugin
  • Loading branch information
sgratzl committed Aug 27, 2015
1 parent eacc55b commit faecf75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* Created by Christian on 11.12.2014.
*/
require(['jquery', 'd3', '../caleydo_core/main', './listeners', './list/listview', './pathgraph/pathgraph2', './setinfo', './datastore',
require(['jquery', 'd3', '../caleydo_core/main', '../caleydo_core/ajax', './listeners', './list/listview', './pathgraph/pathgraph2', './setinfo', './datastore',
'./pathstats/pathstatsview', '../pathfinder_graph/search', './pathutil', './query/queryview', './query/pathquery', './config', './list/pathsorting', './statisticsutil',
'../pathfinder_ccle/ccle', './extradata', 'font-awesome', 'bootstrap'],

function ($, d3, C, listeners, listView, overviewGraph, setInfo, dataStore, pathStatsView, ServerSearch, pathUtil, queryView, pathQuery, config, pathSorting, statisticsUtil, ccle, extradata) {
function ($, d3, C, ajax, listeners, listView, overviewGraph, setInfo, dataStore, pathStatsView, ServerSearch, pathUtil, queryView, pathQuery, config, pathSorting, statisticsUtil, ccle, extradata) {

'use strict';

Expand Down Expand Up @@ -134,7 +134,7 @@ require(['jquery', 'd3', '../caleydo_core/main', './listeners', './list/listview
});

//var selectPaths = d3.select('#select_dump');
//C.getJSON('dump/testpaths.json').then(function (data) {
//ajax.getJSON('dump/testpaths.json').then(function (data) {
// var options = selectPaths.selectAll('option').data([{value: '', label: ''}].concat(data));
// options.enter().append('option')
// .attr('value', function (d) {
Expand All @@ -146,7 +146,7 @@ require(['jquery', 'd3', '../caleydo_core/main', './listeners', './list/listview
//});
//selectPaths.on("change", function () {
// if (this.value != '') {
// C.getJSON(this.value, function (paths) {
// ajax.getJSON(this.value, function (paths) {
// reset();
// loadPaths(paths);
// });
Expand Down Expand Up @@ -184,7 +184,7 @@ require(['jquery', 'd3', '../caleydo_core/main', './listeners', './list/listview
var initialPaths = config.getSamplePathsFile();
if (initialPaths) {

C.getJSON(initialPaths, function (paths) {
ajax.getJSON(initialPaths).then(function (paths) {

var i = 0;

Expand Down
4 changes: 2 additions & 2 deletions extradata.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ define(['exports', '../caleydo_core/main', '../caleydo_core/plugin'], function (
function getData(id, ids) {
var plugins = plugin.list('pathfinder_' + id + '_data');
if (plugins.length === 0) {
return C.resolved({});
return Promise.resolve({});
}
if (plugins.length === 0) {
return plugins[0].load().then(function (impl) {
return impl.factory(ids);
});
}
return C.all(plugins.map(function(p) { return p.load().then(function(impl) { return impl.factory(ids); })})).then(function(datas) {
return Promise.all(plugins.map(function(p) { return p.load().then(function(impl) { return impl.factory(ids); })})).then(function(datas) {
var r = {};
datas.forEach(function(data) {
Object.keys(data).forEach(function(gene) {
Expand Down

0 comments on commit faecf75

Please sign in to comment.