Java API

Deprecation notice
CheerpJ 2 is deprecated. Consider migrating to CheerpJ 3 .

An additional jar (cheerpj-dom.jar) in the CheerpJ downloadable archive has been provided to allow interactions with the browser DOM directly from Java.

This JAR provides declarations for all of the relevant Java interfaces and classes. In particular you will find them wrapped in the com.leaningtech.client package, for example the Document interface of the browser (documented here) becomes com.leaningtech.client.Document with CheerpJ.

The com.leaningtech.client.Global is a representation of the global namespace in the browser context. It only contains static methods and fields.

Usage examples can be found at DOM and JavaScript interoperability.

Global.JSString

Converts a Java String to a JSString.

JSString myjsstring = Global.JSString("Hi!");

Global.JavaString

Converts a JSString to a Java String.

String mystring = Global.JavaString("Hello!");

Global.jsCall / jsCallI / jsCallD / jsCallS

Calls an arbitrary JavaScript function.

MethodParametersOutput
jsCallString funcName, Object… argObject
jsCallIString funcName, Object… argInt
jsCallDString funcName, Object… argDouble
jsCallSString funcName, Object… argJSString

Further reading

Was this page helpful?
Suggest changes