Interface AfterLeaveObserver

Web component route interface with onAfterLeave callback.

Use WebComponentInterface.

interface AfterLeaveObserver {
    onAfterLeave: ((location: RouterLocation<EmptyObject, EmptyObject>, commands: EmptyObject, router: Router<EmptyObject, EmptyObject>) => void);
}

Properties

Properties

onAfterLeave: ((location: RouterLocation<EmptyObject, EmptyObject>, commands: EmptyObject, router: Router<EmptyObject, EmptyObject>) => void)

Type declaration

    • (location, commands, router): void
    • Method that gets executed when user navigates away from the component that had defined the method, just before the element is to be removed from the DOM. The difference between this method and onBeforeLeave is that when this method is executed, there is no way to abort the navigation. This effectively means that the corresponding component should be resolved by the router before the method can be executed. If the router navigates to the same path twice in a row, and this results in rendering the same component name (if the component is created using component property in the route object) or the same component instance (if the component is created and returned inside action property of the route object), in the second time the method is not called. The WebComponent instance on which the callback has been invoked is available inside the callback through the this reference.

      Return values: any return value is ignored and Vaadin Router proceeds with the navigation.

      Arguments:

      Parameters

      • location: RouterLocation<EmptyObject, EmptyObject>

        the RouterLocation object

      • commands: EmptyObject

        empty object

      • router: Router<EmptyObject, EmptyObject>

        the Router instance

      Returns void