Commit 7a231fbc authored by Boris Kocherov's avatar Boris Kocherov

improve async loader now it use build config

parent 476aeff1
...@@ -346,29 +346,7 @@ DocsAPI.DocEditor.version = function () { ...@@ -346,29 +346,7 @@ DocsAPI.DocEditor.version = function () {
'Common.Controllers.Plugins' 'Common.Controllers.Plugins'
]; ];
define("sdk_files", [], function () { define("sdk_files", [], function () {
return [ return "webexcel.json";
"../common/browser.js",
"../common/commonDefines.js",
"../common/docscoapicommon.js",
"../common/docscoapi.js",
"../common/apiCommon.js",
"../common/SerializeCommonWordExcel.js",
"../common/editorscommon.js",
"../common/HistoryCommon.js",
"../common/TableId.js",
"../common/TableIdChanges.js",
"../common/AdvancedOptions.js",
"../cell/apiDefines.js",
"../cell/utils/utils.js",
"../cell/view/HandlerList.js",
"../cell/model/CollaborativeEditing.js",
"../common/apiBase.js",
"../common/Private/license.js",
"../word/apiCommon.js",
"../cell/api.js",
"../common/Local/license.js",
"../common/Local/jio.js"
];
}); });
styles = [ styles = [
'css!../sdkjs/cell/css/main.css', 'css!../sdkjs/cell/css/main.css',
...@@ -396,31 +374,7 @@ DocsAPI.DocEditor.version = function () { ...@@ -396,31 +374,7 @@ DocsAPI.DocEditor.version = function () {
'Common.Controllers.ReviewChanges' 'Common.Controllers.ReviewChanges'
]; ];
define("sdk_files", [], function () { define("sdk_files", [], function () {
return [ return "webword.json";
"../common/browser.js",
"../common/commonDefines.js",
"../common/docscoapicommon.js",
"../common/docscoapi.js",
"../common/spellcheckapi.js",
"../common/spellCheckLanguage.js",
"../common/spellCheckLanguagesAll.js",
"../common/apiCommon.js",
"../common/SerializeCommonWordExcel.js",
"../common/editorscommon.js",
"../common/HistoryCommon.js",
"../common/TableId.js",
"../common/TableIdChanges.js",
"../common/AdvancedOptions.js",
"../word/apiDefines.js",
"../common/CollaborativeEditingBase.js",
"../word/Editor/CollaborativeEditing.js",
"../common/apiBase.js",
"../common/Private/license.js",
"../word/apiCommon.js",
"../word/api.js",
"../common/Local/license.js",
"../common/Local/jio.js"
];
}); });
styles = [ styles = [
'css!documenteditor/main/resources/css/app.css' 'css!documenteditor/main/resources/css/app.css'
...@@ -444,29 +398,7 @@ DocsAPI.DocEditor.version = function () { ...@@ -444,29 +398,7 @@ DocsAPI.DocEditor.version = function () {
'Common.Controllers.ExternalDiagramEditor' 'Common.Controllers.ExternalDiagramEditor'
]; ];
define("sdk_files", [], function () { define("sdk_files", [], function () {
return [ return "webpowerpoint.json";
"../common/browser.js",
"../common/commonDefines.js",
"../common/docscoapicommon.js",
"../common/docscoapi.js",
"../common/apiCommon.js",
"../common/SerializeCommonWordExcel.js",
"../common/editorscommon.js",
"../common/HistoryCommon.js",
"../common/TableId.js",
"../common/TableIdChanges.js",
"../common/AdvancedOptions.js",
"../slide/apiDefines.js",
"../common/CollaborativeEditingBase.js",
"../slide/Editor/CollaborativeEditing.js",
"../common/apiBase.js",
"../common/Private/license.js",
"../word/apiCommon.js",
"../slide/api.js",
"../common/Local/license.js",
"../common/Local/empty_slide.js",
"../common/Local/jio.js"
];
}); });
styles = [ styles = [
'css!presentationeditor/main/resources/css/app.css' 'css!presentationeditor/main/resources/css/app.css'
......
...@@ -12,40 +12,50 @@ define([ ...@@ -12,40 +12,50 @@ define([
'sockjs', 'sockjs',
'jsziputils', 'jsziputils',
'jsrsasign' 'jsrsasign'
], function (urls) { ], function(config_file) {
var script_src = "", return new RSVP.Queue()
queue = new RSVP.Queue(); .push(function () {
return jIO.util.ajax({
function loadScript(src) { type: "GET",
return new RSVP.Promise(function (resolve, reject) { dataType: "json",
var s; url: "sdkjs/build/configs/" + config_file
s = document.createElement('script'); });
s.src = src; })
s.onload = resolve; .push(function (response) {
s.onerror = reject; var script_src = "",
document.head.appendChild(s); queue = new RSVP.Queue();
});
}
urls.forEach(function (url) { function loadScript(src) {
url = url.replace('../', './sdkjs/'); return new RSVP.Promise(function (resolve, reject) {
queue var s;
.push(function () { s = document.createElement('script');
return jIO.util.ajax({ s.src = src;
type: "GET", s.onload = resolve;
url: url s.onerror = reject;
document.head.appendChild(s);
}); });
}) }
.push(function (result) {
script_src += "\n" + result.target.response; response.target.response.compile.sdk.min.forEach(function (url) {
url = url.replace('../', './sdkjs/');
queue
.push(function () {
return jIO.util.ajax({
type: "GET",
url: url
});
})
.push(function (result) {
script_src += "\n" + result.target.response;
});
});
queue.push(function () {
var url = URL.createObjectURL(new Blob([script_src], {type: "text/javascript"}));
return loadScript(url);
}).push(undefined, function (error) {
console.log(error);
throw error;
}); });
}); return queue;
queue.push(function () { });
var url = URL.createObjectURL(new Blob([script_src], {type: "text/javascript"}));
return loadScript(url);
}).push(undefined, function (error) {
console.log(error);
throw error;
});
return queue;
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment