neataptic
Version:
Architecture-free neural network library with genetic algorithm implementations
39 lines (36 loc) • 1.49 kB
JavaScript
var scripts = [
{ type: 'script', url: "https://wagenaartje.github.io/neataptic/cdn/1.3.4/neataptic.js"},
{ type: 'script', url: "https://cdnjs.cloudflare.com/ajax/libs/d3/3.0.0/d3.js"},
{ type: 'script', url: "../../js/articles/neuroevolution/webcola.js"},
{ type: 'script', url: "../../js/articles/playground/events.js"},
{ type: 'script', url: "../../js/articles/playground/graph.js"},
{ type: 'script', url: "../../js/articles/playground/neural.js"},
{ type: 'css', url: "../../js/articles/playground/extra.css"}
];
/** https://stackoverflow.com/questions/33330636/load-javascript-dynamically-and-sequentially **/
function require(list) {
function loadScript(link) {
return new Promise(function(fulfill, reject) {
if(link.type == 'script'){
var script = document.createElement("script");
script.addEventListener("load", fulfill);
script.src = link.url;
document.head.appendChild(script);
} else if(link.type == 'css'){
var stylesheet = document.createElement('link');
stylesheet.addEventListener("load", fulfill);
stylesheet.rel = 'stylesheet';
stylesheet.type = 'text/css';
stylesheet.href = link.url;
stylesheet.media = "screen,print";
document.head.appendChild(stylesheet);
}
});
}
loadScript(list.shift()).then(function() {
if (list.length > 0) {
require(list);
}
})
}
require(scripts);