import * as viewModel from "./view-modes-model" ; import * as calendarModule from "nativescript-ui-calendar" ; let viewModelContext ; export function onPageLoaded ( args ) { const page = args . object ; if ( viewModelContext === undefined ) { viewModelContext = new viewModel . ViewModel ( ) ; } page . bindingContext = viewModelContext ; viewModelContext . updateViewMode ( ) ; } export function onNavigatedFrom ( args ) { if ( args . isBackNavigation === true ) { viewModelContext = undefined ; } } export function onWeekSetViewModeTap ( args ) { viewModelContext . setViewMode ( calendarModule . CalendarViewMode . Week ) ; } export function onMonthSetViewModeTap ( args ) { viewModelContext . setViewMode ( calendarModule . CalendarViewMode . Month ) ; } export function onMonthNamesSetViewModeTap ( args ) { viewModelContext . setViewMode ( calendarModule . CalendarViewMode . MonthNames ) ; } export function onYearSetViewModeTap ( args ) { viewModelContext . setViewMode ( calendarModule . CalendarViewMode . Year ) ; } export function onDaySetViewModeTap ( args ) { viewModelContext . setViewMode ( calendarModule . CalendarViewMode . Day ) ; }