SideDrawer: Events

RadSideDrawer fires several events informing about changes in the component's state. The following events are exposed by RadSideDrawer:

Handling RadSideDrawer's events

You can subscribe for RadSideDrawer's events in the classical {N} way - either in your XML file or programmatically. The following snippets demonstrates a scenario in which all four events are handled by assigning handlers in the XML definition. The source of the handlers is also demonstrated:

<drawer:RadSideDrawer id="sideDrawer"
                      drawerClosed="onDrawerClosed"
                      drawerClosing="onDrawerClosing"
                      drawerOpened="onDrawerOpened"
                      drawerOpening="onDrawerOpening">
  <drawer:RadSideDrawer.drawerTransition>
    <drawer:RevealTransition/>
  </drawer:RadSideDrawer.drawerTransition>
  <drawer:RadSideDrawer.mainContent>
  </drawer:RadSideDrawer.mainContent>
  <drawer:RadSideDrawer.drawerContent>
  </drawer:RadSideDrawer.drawerContent>
</drawer:RadSideDrawer>
export function onDrawerClosed(args) {
    drawerCallbacksModel.onDrawerClosed();
    console.log("OnDrawerClosed");
}

export function onDrawerClosing(args) {
    drawerCallbacksModel.onDrawerClosing();
    console.log("OnDrawerClosing");
}

export function onDrawerOpened(args) {
  drawerCallbacksModel.onDrawerOpened();
  console.log("OnDrawerOpened");
}

export function onDrawerOpening(args) {
    drawerCallbacksModel.onDrawerOpening();
    console.log("OnDrawerOpening");
}
function onDrawerClosed(args) {
    drawerCallbacksModel.onDrawerClosed();
    console.log("OnDrawerClosed");
}
exports.onDrawerClosed = onDrawerClosed;
function onDrawerClosing(args) {
    drawerCallbacksModel.onDrawerClosing();
    console.log("OnDrawerClosing");
}
exports.onDrawerClosing = onDrawerClosing;
function onDrawerOpened(args) {
    drawerCallbacksModel.onDrawerOpened();
    console.log("OnDrawerOpened");
}
exports.onDrawerOpened = onDrawerOpened;
function onDrawerOpening(args) {
    drawerCallbacksModel.onDrawerOpening();
    console.log("OnDrawerOpening");
}
exports.onDrawerOpening = onDrawerOpening;

References

Want to see this scenario in action?
Check our SDK examples repo on GitHub. You will find this and many other practical examples with NativeScript UI.