GWT创建实用工具javascript库

时间:2022-03-22 07:42:24

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

我需要创建将从其他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) ?

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

Any other java to javascript convertion tool is wellcome.

任何其他java到javascript转换工具是很好的。

2 个解决方案

#1


14  

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

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

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

但是,我不知道目前任何大规模的项目,所以你可能会开辟新的道路。

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.

从2008年开始的GWT博客文章中介绍了从JS调用GWT代码的基础知识,特别是“使用GWT创建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 Exporter,它“包含一个能够获取GWT类并将其作为普通Javascript API导出的生成器,可以从没有JSNI的手写Javascript中调用”

#2


2  

Check out:

https://code.google.com/p/gwt-exporter/

Develop an application or library in GWT and use gwtexporter annotations to make classes and methods available from javascript.

在GWT中开发应用程序或库,并使用gwtexporter注释从javascript中提供类和方法。

#1


14  

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

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

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

但是,我不知道目前任何大规模的项目,所以你可能会开辟新的道路。

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.

从2008年开始的GWT博客文章中介绍了从JS调用GWT代码的基础知识,特别是“使用GWT创建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 Exporter,它“包含一个能够获取GWT类并将其作为普通Javascript API导出的生成器,可以从没有JSNI的手写Javascript中调用”

#2


2  

Check out:

https://code.google.com/p/gwt-exporter/

Develop an application or library in GWT and use gwtexporter annotations to make classes and methods available from javascript.

在GWT中开发应用程序或库,并使用gwtexporter注释从javascript中提供类和方法。