Skip to content

Commit 05d88e2

Browse files
committed
Standardized and fixed typos
1 parent 38c8304 commit 05d88e2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sites/cheerpj/src/content/docs/11-guides/implementing-native-libraries.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ In general, we can implement native libraries in CheerpJ by following these step
2323
2. Create a JavaScript module that implements the native methods.
2424
3. Load the native library in the Java class with CheerpJ.
2525

26-
### Loading native nibraries and declaring native methods in Java
26+
### Loading native libraries and declaring native methods in Java
2727

2828
To declare a native method in Java, use the `native` keyword in the method declaration. The method is defined in the Java class but is not implemented in Java. Instead, the implementation will be provided in the native library JavaScript module which is loaded with `System.loadLibrary`.
2929

@@ -39,7 +39,7 @@ public class ClassName {
3939
}
4040
```
4141

42-
### Creating a JavaScript module
42+
### Creating a JavaScript module and implementing the native methods
4343

4444
A JavaScript module is a file that contains code which can be exported and imported by other files for better organization and reuse. You create modules using the `export` keyword to expose classes, methods, or other resources, and you can use `export default` to make a primary, easy-to-import item from the module. For more information on JavaScript modules, check out the official [`documentation`].
4545

@@ -49,7 +49,7 @@ export default {
4949
};
5050
```
5151

52-
JavaScript functions that implement native methods should follow a specific naming convention - `Java_<fully-qualified-class-name>_<method-name>`. For instance, if `com.foo.Bar` has a native method called `baz`, the function will be called `Java_com_foo_Bar_baz`
52+
To implement a native method in JavaScript, create an `async` function that follows the naming convention `Java_<fully-qualified-class-name>_<method-name>`. For instance, if `com.foo.Bar` has a native method called `baz`, the function will be called `Java_com_foo_Bar_baz`.
5353

5454
The JavaScript function should accept the following parameters:
5555

0 commit comments

Comments
 (0)