Annotation Interface JsDefinition


@Documented @Target(TYPE) @Retention(RUNTIME) public @interface JsDefinition
Marks an interface whose methods declare the JavaScript they run with JsExpression, to be called through Element.executeJs(Class), or, when its methods return snippets, through JsSnippets.of(Class). An interface declares one of the two kinds.

The annotation is what makes the interface findable during the build: every annotated interface is collected into the generated bundle as a function per method, so the JavaScript an application can invoke from the server is known before it runs and the client never has to build a function from a string. That is what keeps a server-initiated call compatible with a content security policy that does not allow unsafe-eval.

Since:
25.4
See Also: