Interface ReactContextProvider

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ReactContextProvider
Provides callback-scoped access to a context capable of executing JavaScript.

The callback must not return the context or context-owned values to application code. Renderer implementations may associate context-bound caches with the context, but providers retain ownership and providers that do not own their contexts must leave them open when sources change.

Since:
6.3.0
Author:
Micronaut Team
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    sourcesChanged(long generation)
    Notify the provider that React sources have changed.
    <T> T
    withContext(Function<org.graalvm.polyglot.Context, T> callback)
    Execute a callback with exclusive access to a context.
  • Method Details

    • withContext

      <T> T withContext(Function<org.graalvm.polyglot.Context, T> callback)
      Execute a callback with exclusive access to a context.
      Type Parameters:
      T - The callback result type
      Parameters:
      callback - The callback
      Returns:
      The callback result
    • sourcesChanged

      default void sourcesChanged(long generation)
      Notify the provider that React sources have changed.
      Parameters:
      generation - The new source generation