Skip to content

Commit d894ede

Browse files
docs: drop 25.5 badges, JsModuleInvokers and @JsDefinitionImport are in 25.4
Both were backported to Flow 25.4, so the 25.4 badge of the enclosing Declaring JavaScript in Java section already covers them.
1 parent dd9fe8e commit d894ede

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎articles/flow/component-internals/element-api/calling-javascript.adoc‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The other methods described on this page -- [methodname]`executeJs(String, Objec
2121
[role="since:com.vaadin:vaadin@V25.4"]
2222
== Declaring JavaScript in Java
2323

24-
An interface annotated with [annotationname]`@JsDefinition` declares JavaScript that the build collects into the bundle. It also extends one of the marker interfaces, which decides what its methods declare: [interfacename]`JsInvokers`, covered in this section, for JavaScript that runs on an element when a method is called; [since:com.vaadin:vaadin@V25.5]#[interfacename]`JsModuleInvokers` for JavaScript that runs on what a JavaScript module exports, called through [methodname]`Page.executeModuleJs(Class)`;# or [interfacename]`JsSnippets` for JavaScript that's only passed on as a function (see <<#declaring-snippets,Declaring Snippets>>). An interface extends only one of them.
24+
An interface annotated with [annotationname]`@JsDefinition` declares JavaScript that the build collects into the bundle. It also extends one of three marker interfaces, which decides what its methods declare: [interfacename]`JsInvokers`, covered in this section, for JavaScript that runs on an element when a method is called; [interfacename]`JsModuleInvokers` for JavaScript that runs on what a JavaScript module exports, called through [methodname]`Page.executeModuleJs(Class)`; or [interfacename]`JsSnippets` for JavaScript that's only passed on as a function (see <<#declaring-snippets,Declaring Snippets>>). An interface extends only one of them.
2525

2626
Call the declared JavaScript of a [interfacename]`JsInvokers` interface through [methodname]`Element.executeJs(Class)`, which hands out an implementation of the interface; calling a method of it schedules the JavaScript that the method declares.
2727

@@ -135,7 +135,6 @@ The interface is checked when [methodname]`executeJs(Class)` hands out the imple
135135
When the JavaScript isn't about a particular element, declare it the same way and run it through [methodname]`Page.executeJs(Class)`, which works with global browser APIs instead of with an element (see <</flow/advanced/browser-access#declaring-javascript-in-java,Accessing the Browser Page>>). There, every method needs [annotationname]`@JsExpression`, since there's no element whose JavaScript function could be called.
136136

137137
[[importing-module-exports]]
138-
[role="since:com.vaadin:vaadin@V25.5"]
139138
=== Importing Module Exports
140139

141140
[annotationname]`@JsDefinitionImport` imports names from a JavaScript module, so the expressions of a definition can call what the module exports. The module doesn't need to put anything on `window`:
@@ -201,7 +200,7 @@ An interface annotated with [annotationname]`@JsDefinition` that extends [interf
201200

202201
A snippet isn't bound to an element, so get the implementation of its interface from [methodname]`JsSnippets.of(Class)` rather than from [methodname]`executeJs(Class)`. The implementation holds no state, so it can be kept in a constant and shared.
203202

204-
An interface extends exactly one of [interfacename]`JsInvokers`, [since:com.vaadin:vaadin@V25.5]#[interfacename]`JsModuleInvokers`,# and [interfacename]`JsSnippets`. Passing a [interfacename]`JsSnippets` interface to [methodname]`executeJs(Class)`, or a [interfacename]`JsInvokers` interface to [methodname]`JsSnippets.of()`, is a compile error, since each method accepts only the matching marker type. A method whose return type doesn't match the kind the interface declares is refused with the method named.
203+
An interface extends exactly one of [interfacename]`JsInvokers`, [interfacename]`JsModuleInvokers`, and [interfacename]`JsSnippets`. Passing a [interfacename]`JsSnippets` interface to [methodname]`executeJs(Class)`, or a [interfacename]`JsInvokers` interface to [methodname]`JsSnippets.of()`, is a compile error, since each method accepts only the matching marker type. A method whose return type doesn't match the kind the interface declares is refused with the method named.
205204

206205
The arguments of the Java call are captured and available in the expression as `$0`, `$1`, and so on. The expression is the body of the function, so it has to `return` a value if the caller expects one. The function takes no parameters of its own, unless the method is annotated with [annotationname]`@JsFunctionParameterNames`, which names the parameters that the caller passes to the function when it calls it.
207206

0 commit comments

Comments
 (0)