author Yermo Lamers, Flying Brick Software, LLC
 import { Component , OnInit , OnDestroy } from "@angular/core" ; import { RadSideDrawer } from "nativescript-ui-sidedrawer" ; import * as app from "tns-core-modules/application" ; import { RouterExtensions } from "nativescript-angular/router" ; import { EventsService } from '../../services/events.service' ; import { DebugService } from '../../services/debug.service' ; import { SETTINGS } from '../../../../../mapbox_config' ; /**
* Toggle Map test.
*
* This toggles creating/destroying the map.
*/ @ Component ( { selector : "toggle-map-test-page" , moduleId : module . id , templateUrl : "./toggle-map-test-page.component.html" } ) export class ToggleMapTestPageComponent implements OnInit , OnDestroy { settings : any = SETTINGS ; shown : boolean = true ; constructor ( private routerExtensions , private eventsService , private debugService ) { console . log ( "ToggleMapTestPageComponent:constructor()" ) ; } ngOnInit ( ) { } toggleMapDestroy ( ) { if ( ! this . shown ) { console . log ( "ToggleMapTestPageComponent::toggleMap(): ------ toggle map '" + this . debugService . incrementCounter ( 'mapToggleDestroy' ) ) ; this . eventsService . publish ( "destroyMap" , { mapId : 'toggleTest' } ) ; } this . shown = ! this . shown ; } toggleMap ( ) { if ( ! this . shown ) { console . log ( "ToggleMapTestPageComponent::toggleMap(): ------ toggle map '" + this . debugService . incrementCounter ( 'mapToggle' ) ) ; } this . shown = ! this . shown ; } link ngOnDestroy ( ) { console . log ( "ToggleMapTestPageComponent::ngOnDestroy()" ) ; } onDrawerButtonTap ( ) { const sideDrawer = < RadSideDrawer > app . getRootView ( ) ; sideDrawer . showDrawer ( ) ; } }