commit 2af0129ccf328db2e90e09996482adf8ff81f3ec Author: woni <320753691@qq.com> Date: Fri Mar 29 20:43:16 2024 +0800 first commit diff --git a/demo.js b/demo.js new file mode 100644 index 0000000..90b3e4a --- /dev/null +++ b/demo.js @@ -0,0 +1,90 @@ +var projInfo = { + name: "XbotWps", + type: "et", +}; + +var invokeParam = { + flag: "openOfficeFile", + filepath: null, +}; + +function GetVersion(callBack) { + var url = GetUrlBase() + "/version"; + startWps({ + url: url, + data: "", + callBack: function (res) { + callBack && callBack(res); + if (res.status !== 0 && res.message !== "Subserver not available.") { + serverVersion = "wait"; + return; + } + if (res.response && serverVersion == "wait") { + serverVersion = res.response; + sessionStorage.setItem("serverVersion", serverVersion); + } + }, + tryCount: 4, + bPop: true, + timeout: 5000, + }); +} + +function createXHR() { + if (typeof XMLHttpRequest != 'undefined') { + return new XMLHttpRequest(); + } +} + +function getHttpObj() { + var httpobj = null; + httpobj = new createXHR(); + return httpobj; +} + +function WpsStartWrapVersion(clientType, name, func, param, callBack, showToFront, jsPluginsXml, silentMode, timeout, startparam) { + var paramEx = { + jsPluginsXml: jsPluginsXml ? jsPluginsXml : "", + showToFront: typeof (showToFront) == 'boolean' ? showToFront : true, + param: (typeof (param) == 'object' ? param : JSON.parse(param)) + } + var options = { + clientType: clientType, + name: name, + func: func, + param: paramEx, + urlBase: GetUrlBase(), + callBack: callBack, + wpsclient: undefined, + concurrent: true, + silentMode: silentMode, + timeout: timeout, + startparam: startparam, + } + WpsStartWrapVersionInner(options); +} + + +var WpsInvoke = { + InvokeAsHttp: WpsStartWrapVersion, + InvokeAsHttps: WpsStartWrapVersion, + RegWebNotify: RegWebNotify, + ClientType: { + wps: "wps", + et: "et", + wpp: "wpp", + pdf: "pdf", + }, + CreateXHR: getHttpObj, + IsClientRunning: IsClientRunning, + GetVersion: GetVersion, + RegWebNotifyEnable: true, +}; + +WpsInvoke.InvokeAsHttp( + projInfo.type, + projInfo.name, + "openOfficeFileFromSystemDemo", + JSON.stringify(invokeParam), + callbackFunc, +); diff --git a/demo.py b/demo.py new file mode 100644 index 0000000..e69de29