简体   繁体   English

有没有办法从客户端用户界面调用库?

[英]Is there any way to call a library from a client side user interface?

I'm building a user interface in HTML Service for Google Apps Script and I want to be able to call functions from a library that is loaded in the server side .gs file of my script.我正在为 Google Apps 脚本在 HTML 服务中构建用户界面,并且我希望能够从我脚本的服务器端 .gs 文件中加载的库中调用函数。 The client side call to the server side library does not seem to work.客户端对服务器端库的调用似乎不起作用。 Is this possible to do?这是可能的吗?

I'm pretty new to javascript/apps script so excuse me if I'm mis-stating what's happening here.我对 javascript/apps 脚本很陌生,所以如果我错误地说明了这里发生的事情,请原谅我。

UPDATE: Here's the solution I used更新:这是我使用的解决方案

On the container bound script:在容器绑定脚本上:

function libraryHandler(functionName){
  return eval("libraryIdentifier." + functionName);
}

In the library:在图书馆:

google.script.run.libraryHandler('myLibraryFunctionName(param1,param2,etc.)')

Make a "dummy" function in the same script where the html is.在 html 所在的同一脚本中创建一个“虚拟”函数。 Make that dummy call your library function.让那个虚拟调用你的库函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 淘汰的用户界面-有什么办法可以纠正它? - Washed out user interface - is there any way to correct for it? 是否提供任何用户界面来并排查看 Azure 认知服务 READ OCR output 源文档? - Is there any User Interface offered to view the Azure Cognitive Services READ OCR output side-by-side the source document? 有没有办法从tkinter gui调用龟屏? - Is there any way to call turtle screen from tkinter gui? 最好/最完整的jQuery用户界面库? - Best / most complete jQuery user interface library? 创建行为类似于Google Maps的界面(客户端) - Creating interface(client side) that behaves like google maps 是否有用于Eclipse的用户界面原型设计工具? - Are there any user interface prototyping tools for Eclipse? 是否有为移动设备设计用户界面的指南? - Are there any guidelines for designing user interface for mobile devices? 有什么方法可以使用 wxpython 在 GUI 界面上从 sql server 检索实时数据? - Is there any way to retrieve real time data from sql server on GUI interface with wxpython? 你怎么称呼这个用户界面控件? - What do you call this user interface control? Android用户界面设计-整合的最佳方法? - Android User Interface Design - Best way to integrate it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM