The translation was generated automatically and may contain mistakes
RouteNavigator.runSync
Consistently invokes object methods RouteNavigator Ensure that all calls are completed at the same time.
Important! Don’t run multiple instances runSync simultaneously. This can lead to a race condition where multiple processes try to access the same resource at the same time and the result becomes unpredictable.
To avoid mistakes, do not use the method.. runSync other transitions in navigation.
Example
TypeScript
import { useRouteNavigator } from '@vkontakte/vk-mini-apps-router';
export function SomePage() {
const routeNavigator = useRouteNavigator();
// ?4??4??4??4??1? ?4??4??4??4??4??1? ?4??5??4??4??4??4??1?
const foo = [
() => routeNavigator.back(-2),
() => routeNavigator.replace('/'),
() => routeNavigator.push('/persik')
]);
return (
// ?4??5??4??4??1? ?4??4??4??4??4??1?
<Button onClick={() => routeNavigator.runSync(foo) }>?4??4??4??4??4??5??1? ?4??4??4??4??4??4??1?</Button>
);
}Announcement
TypeScript
runSync(actions: VoidFunction[]): Promise<void>;Parameters
Parameter | Type | Description |
|---|---|---|
action
Mandatory | VoidFunction[] | An array of functions, each calling an object method RouteNavigator .
Important! Each function should call only one method. |
Result
Object Promise which is allowed if the transition is successful. Works for official purposes. Using this object in your code is usually unnecessary.
Materials on the topic
- •
- •
- •
- •
- •