The GlobalPlugin interface represents a global plugin that can be used with the application. It provides a set of lifecycle methods that can be implemented to hook into different stages of the application's lifecycle.

interface GlobalPlugin {
    beforeAnimate?: ((app, elapsed, widget) => void);
    beforeCanvasKitLoaded?: ((engine) => void);
    beforeCheckout?: ((app, scene) => void);
    beforePatch?: ((app, elapsed, old, now) => void);
    beforeSurfaceLoaded?: ((app) => void);
    beforeUpdate?: ((app, elapsed) => void);
    key: string;
    name: string;
    onAnimate?: ((app, elapsed, widget) => void);
    onCanvasKitLoaded?: ((engine) => void);
    onCheckout?: ((app, scene) => void);
    onPatch?: ((app, elapsed, old, now) => void);
    onSurfaceLoaded?: ((app, surface) => void);
    onUpdate?: ((app, elapsed) => void);
    version: string;
}

Properties

beforeAnimate?: ((app, elapsed, widget) => void)

Called before a widget is animated.

Type declaration

    • (app, elapsed, widget): void
    • Parameters

      • app: LocalApp | App

        The instance of the application.

      • elapsed: number

        The elapsed time since the last update.

      • widget: Widget

        The widget to be animated.

      Returns void

beforeCanvasKitLoaded?: ((engine) => void)

Called before the CanvasKit library is loaded by the engine.

Type declaration

    • (engine): void
    • Parameters

      • engine: CarEngine

        The instance of the CarEngine.

      Returns void

beforeCheckout?: ((app, scene) => void)

Called before a new scene is checked out by the application.

Type declaration

    • (app, scene): void
    • Parameters

      • app: LocalApp | App

        The instance of the application.

      • scene: Scene

        The new scene to be checked out.

      Returns void

beforePatch?: ((app, elapsed, old, now) => void)

Called before the application patches the old widget with the new widget.

Type declaration

    • (app, elapsed, old, now): void
    • Parameters

      • app: LocalApp | App

        The instance of the application.

      • elapsed: number

        The elapsed time since the last update.

      • old: Widget

        The old widget.

      • now: Widget

        The new widget.

      Returns void

beforeSurfaceLoaded?: ((app) => void)

Called before a surface is created by the application.

Type declaration

    • (app): void
    • Parameters

      Returns void

beforeUpdate?: ((app, elapsed) => void)

Called before the application updates.

Type declaration

    • (app, elapsed): void
    • Parameters

      • app: LocalApp | App

        The instance of the application.

      • elapsed: number

        The elapsed time since the last update.

      Returns void

key: string

A unique identifier for the plugin.

name: string

The name of the plugin.

onAnimate?: ((app, elapsed, widget) => void)

Called after a widget is animated.

Type declaration

    • (app, elapsed, widget): void
    • Parameters

      • app: LocalApp | App

        The instance of the application.

      • elapsed: number

        The elapsed time since the last update.

      • widget: Widget

        The widget that has been animated.

      Returns void

onCanvasKitLoaded?: ((engine) => void)

Called after the CanvasKit library is loaded by the engine.

Type declaration

    • (engine): void
    • Parameters

      • engine: CarEngine

        The instance of the CarEngine.

      Returns void

onCheckout?: ((app, scene) => void)

Called after a new scene is checked out by the application.

Type declaration

    • (app, scene): void
    • Parameters

      • app: LocalApp | App

        The instance of the application.

      • scene: Scene

        The new scene that has been checked out.

      Returns void

onPatch?: ((app, elapsed, old, now) => void)

Called after the application patches the old widget with the new widget.

Type declaration

    • (app, elapsed, old, now): void
    • Parameters

      • app: LocalApp | App

        The instance of the application.

      • elapsed: number

        The elapsed time since the last update.

      • old: Widget

        The old widget.

      • now: Widget

        The new widget.

      Returns void

onSurfaceLoaded?: ((app, surface) => void)

Called after a surface is created by the application.

Type declaration

    • (app, surface): void
    • Parameters

      • app: LocalApp | App

        The instance of the application.

      • surface: Surface

        The surface instance.

      Returns void

onUpdate?: ((app, elapsed) => void)

Called after the application updates.

Type declaration

    • (app, elapsed): void
    • Parameters

      • app: LocalApp | App

        The instance of the application.

      • elapsed: number

        The elapsed time since the last update.

      Returns void

version: string

The version of the plugin.