import { Page , ShownModallyData , Observable } from '@nativescript/core' ; let page ; let closeCallback ; export function onShownModally ( args ) { page = < Page > args . object ; page . bindingContext = new SampleModal ( ) ; closeCallback = args . closeCallback ; if ( args . context ) { args . context . shownModally = true ; } } export class SampleModal extends Observable { close ( ) { closeCallback ( ) ; } }