GWT 创建实用程序 javascript 库 [英] GWT to create utility javascript library

查看:20
本文介绍了GWT 创建实用程序 javascript 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个可以从其他 javascript 代码中调用的 javascript 库.

I need to create javascript library which will be called from other javascript code.

是否可以使用 GWT 和 Java 类创建 javascript 库?没有入口点,没有用户界面——只有一些具有公共静态和对象方法的实用 javascript 类(例如加密库、图像处理库、用户输入验证库等)?

Is it possible to create javascript library using GWT and Java classes? No entry points, no UI - just some utility javascript classes with public static and object methods (e.g. encryption library, image processing library, user input validation library, etc) ?

欢迎使用任何其他 java 到 javascript 转换工具.

Any other java to javascript convertion tool is wellcome.

推荐答案

是的,可以编写页面上其他 JavaScript 可以调用的 GWT 代码.

Yes, it's possible to write GWT code that other JavaScript on the page can call.

但是,我不知道目前有任何项目在大规模执行此操作,因此您可能会开辟新的道路.

However, I don't know of any projects that currently do this in any large scale, so you maybe blazing a new trail.

从 JS 调用 GWT 代码的基础在 这篇 GWT 博客文章来自 2008 年,特别是名为使用 GWT 创建 JavaScript 库"的部分并不奇怪.

The basics of calling GWT code from JS is covered in this GWT blog post from 2008, particularly the section called "Creating JavaScript libraries with GWT" unsurprisingly.

该博客文章中链接的另一个项目是 GWT导出器,它包含一个生成器,能够获取 GWT 类并将它们导出为普通 Javascript API,可从没有 JSNI 的手写 Javascript 中调用"

Another project which is linked in that blog post, and maybe of interest to you, is GWT Exporter, which "contains a generator capable of taking GWT classes and exporting them as ordinary Javascript APIs callable from hand-written Javascript without JSNI"

这篇关于GWT 创建实用程序 javascript 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆