@grabjs/superapp-sdk
    Preparing search index...

    Class PlatformModule

    JSBridge module for controlling platform navigation.

    Provides methods to interact with the native platform navigation stack, such as triggering the back action. This code must run on the Grab SuperApp's WebView to function correctly.

    ES Module:

    import { PlatformModule } from '@grabjs/superapp-sdk';
    const platform = new PlatformModule();

    CDN (UMD):

    <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
    <script>
    const platform = new SuperAppSDK.PlatformModule();
    </script>

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Triggers the native platform back navigation. This navigates back in the native navigation stack.

      Returns Promise<BackResponse>

      Confirmation that the back navigation was triggered.

      Simple usage

      import { PlatformModule, isSuccess, isErrorResponse } from '@grabjs/superapp-sdk';

      // Initialize the platform module
      const platform = new PlatformModule();

      // Trigger back navigation
      const response = await platform.back();

      // Handle the response
      if (isSuccess(response)) {
      console.log('Back navigation triggered');
      } else if (isErrorResponse(response)) {
      console.error(`Error ${response.status_code}: ${response.error}`);
      } else {
      console.error('Unhandled response');
      }