Navigation

Give the user a tour of your beautiful app using the navigation functions.

Open a different block from the app. The block will be shown in a dialog-like fashion with a close button instead of a back button.

import { navigate } from '@myjsblock/sdk'

await navigate('List6');
// List6 was closed

Passing properties​

Data can be passed to the page by using the properties argument. Data will be exposed in to the block via the data fields and {data:<name>} template syntax. For example, for payment and checkout pages or other detail pages.

import { navigate } from '@myjsblock/sdk'

await navigate('List6', {
    paymentId: '123456'
});

// List6 was closed

Arguments​

NameTypeRequiredDefault

variableName

String

βœ…

-

properties

{ [key]: anyValue }

-

Errors​

Here is a list of errors that can be thrown when calling this function in addition to generic errors:

Error CodeDescription

INVALID_ARGUMENT

There is no block with variable name variableName.

Go Back​

Great for custom back buttons. By calling this function the user will be navigated back to the previous block, like pressing back on the device.

import { goBack } from '@myjsblock/sdk'

await goBack();

Example​

import { goBack } from '@myjsblock/sdk'

async function onPaymentComplete() {
    await goBack(
      true
    );
}

Arguments

NameTypeRequiredDefault

reload

Boolean

false

Errors​

Here is a list of errors that can be thrown when calling this function in addition to generic errors:

Last updated