Skip to content

Conversation

@rijulshrestha
Copy link
Contributor

No description provided.

@rijulshrestha rijulshrestha self-assigned this Oct 29, 2025
@rijulshrestha rijulshrestha added the documentation Improvements or additions to documentation label Oct 29, 2025
@rijulshrestha
Copy link
Contributor Author

I've simplified the code a bit. And I had to add type="module" in the script tag for the example to work in my machine.
I belive we should move the 'Calling back into Java from JavaScript' at the end of before 'Example Walkthrough' as does not fully fall under the scope of the Native Methods guide. Pleasse suggest.

@rijulshrestha rijulshrestha marked this pull request as ready for review October 29, 2025 14:39
Copy link
Member

@epanholz epanholz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we can move the "Calling back into Java from JavaScript" after the "Walkthrough". Same goes for the "Converting Parameters and Return Values" part. Please move both of these further down. Maybe we should add one main header for the example, so it looks like this:
├── Steps to implement native methods in CheerpJ
    ├── Declaring Native Methods in Java
    ├── Implementing Native Methods in JavaScript
    ├── Initializing CheerpJ with the natives option
    └── Example Walkthrough
├── Calling back into Java from JavaScript
└── Converting Parameters and Return Values

We do the same in the native libraries guide.

public class Example {
public static void main(String[] args) {
nativeAlert("Hello, world!");
Alert("Hello, world!");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We added the "native" prefix to all the previous native functions. Also leave it here for consistency.

@rijulshrestha
Copy link
Contributor Author

rijulshrestha commented Oct 30, 2025

I tried to reorder the page itself in the documentation site where currenty the native methods guide comes after the native libraries but couldn't figure out how to do it. This following order would make more sense.
├── Implementing Native Methods
├── Implementing Native Libraries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants