mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-02-10 18:15:19 +08:00
Add async functions to plugin object
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -762,6 +762,23 @@ window.startPluginApi = function() {
|
||||
_client.send();
|
||||
};
|
||||
|
||||
let isAsyncSupported = false;
|
||||
try
|
||||
{
|
||||
new Function("async function test() {}");
|
||||
isAsyncSupported = true;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
isAsyncSupported = false;
|
||||
}
|
||||
|
||||
if (isAsyncSupported)
|
||||
{
|
||||
eval("Asc.plugin.callCommandAsync = function(func) { return new Promise(function(resolve) { Asc.plugin.callCommand(func, false, true, function(retValue) { resolve(retValue); }) }); };");
|
||||
eval("Asc.plugin.callMethodAsync = function(name, args) { return new Promise(function(resolve) { Asc.plugin.executeMethod(name, args || [], function(retValue) { resolve(retValue); }) }); };");
|
||||
}
|
||||
|
||||
/**
|
||||
* @function attachEvent
|
||||
* @undocumented
|
||||
|
||||
Reference in New Issue
Block a user