提交 5de9066f 编写于 作者: K Kevin Nadro

fixed reloading of the algorithm

- changed the save/load of the algorithm for it correctly returns to
the example after closing the generate overlay
上级 762e08b3
......@@ -3,29 +3,39 @@
const modules = require('../module');
const array2d = require('./array2d');
const util = require('./util');
const Server = require('../server');
const DOM = require('../dom');
const closeCreate = (modules) => {
const {
getPath
} = require('../server/helpers');
const closeCreate = () => {
const $btnClose = $('#btn_close');
$btnClose.click(() => {
$('.sandbox_container').remove();
util.clearModules();
restoreModules(modules);
reloadAlgorithm();
});
};
const restoreModules = (modules) => {
for (var i = 0; i < modules.length; i++) {
$('.module_container').append(modules[i]);
}
};
const reloadAlgorithm = () => {
const {
category,
algorithm,
file
} = getPath();
const saveModules = () => {
return $('.module_wrapper')
Server.loadAlgorithm(category, algorithm).then((data) => {
DOM.showAlgorithm(category, algorithm, data);
});
};
const init = () => {
var moduleWrappers = saveModules();
var check = $('.sandbox_container');
if(!check.length){
util.clearModules();
......
......@@ -32,7 +32,6 @@ RSVP.on('error', function (reason) {
});
$(() => {
// initialize the application and attach in to the instance module
const appConstructor = new AppConstructor();
extend(true, app, appConstructor);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册