Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
174 views
in Technique[技术] by (71.8m points)

java - GWT to create utility javascript library

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

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) ?

Any other java to javascript convertion tool is wellcome.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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.

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"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...