mtl-js-sdk
Version:
94 lines (81 loc) • 2.81 kB
JavaScript
"use strict";
define(function () {
var fileSystem = {};
var u8c_test = 'http://ezone-u8c-test.yyuap.com/cooperation/cooperation-mobile/js/cooperation-app.min.js';
var u8c_daily = 'https://ezone-u8c-daily.yyuap.com/cooperation/cooperation-mobile/js/cooperation-app.min.js';
var ys_pre = 'https://ezone-yonsuite-pre.diwork.com/cooperation/cooperation-mobile/css/cooperation-app.min.js';
var pre = 'https://ezone-pre.diwork.com/cooperation/cooperation-mobile/js/cooperation-app.min.js';
var online = 'https://ezone.diwork.com/cooperation/cooperation-mobile/js/cooperation-app.min.js';
function loadJs(url) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.head.appendChild(script);
}
fileSystem.fileSystemInit = function (object) {
var _object$environment = object.environment,
environment = _object$environment === void 0 ? 'u8c_daily' : _object$environment,
jsUrl = object.jsUrl;
if (jsUrl && jsUrl !== '') {
loadJs(jsUrl);
console.log('load custom file JS');
} else {
switch (environment) {
case 'u8c_test':
loadJs(u8c_test);
break;
case 'u8c_daily':
loadJs(u8c_daily);
break;
case 'ys_pre':
loadJs(ys_pre);
break;
case 'pre':
loadJs(pre);
break;
case 'online':
loadJs(online);
break;
default:
loadJs(u8c_daily);
break;
}
}
};
fileSystem.fileSystemRender = function (object) {
var el = object.el,
objectId = object.objectId,
objectName = object.objectName,
_object$openAtNotice = object.openAtNotice,
openAtNotice = _object$openAtNotice === void 0 ? true : _object$openAtNotice,
_object$openReplyNoti = object.openReplyNotice,
openReplyNotice = _object$openReplyNoti === void 0 ? true : _object$openReplyNoti,
_object$tabs = object.tabs,
tabs = _object$tabs === void 0 ? ['files'] : _object$tabs,
onClickClose = object.onClickClose;
YYCooperationBridge.ready(function () {
YYCooperationBridge.YYRenderCooperation({
el: el,
objectId: objectId,
objectName: objectName,
openAtNotice: openAtNotice,
openReplyNotice: openReplyNotice,
tabs: tabs,
onClickClose: onClickClose
});
});
};
fileSystem.fileSystemPrivateConfig = function (object) {
var host = object.host,
task = object.task,
flow = object.flow,
comment = object.comment;
YYCooperationBridge && YYCooperationBridge.init({
host: host,
task: task,
flow: flow,
comment: comment
});
};
return fileSystem;
});