import { App } from '../app/app' ; import { Config } from '../../config/config' ; import { isPresent } from '../../util/util' ; import { PORTAL_LOADING } from '../app/app-constants' ; import { LoadingCmp } from './loading-component' ; import { LoadingOptions } from './loading-options' ; import { LoadingMdPopIn , LoadingMdPopOut , LoadingPopIn , LoadingPopOut , LoadingWpPopIn , LoadingWpPopOut } from './loading-transitions' ; import { NavOptions } from '../../navigation/nav-util' ; import { ViewController } from '../../navigation/view-controller' ; hidden export class Loading extends ViewController { private _app : App ; constructor ( app , opts = { } , config ) { opts . showBackdrop = isPresent ( opts . showBackdrop ) ? ! ! opts . showBackdrop : true ; opts . enableBackdropDismiss = isPresent ( opts . enableBackdropDismiss ) ? ! ! opts . enableBackdropDismiss : false ; opts . dismissOnPageChange = isPresent ( opts . dismissOnPageChange ) ? ! ! opts . dismissOnPageChange : false ; super ( LoadingCmp , opts , null ) ; this . _app = app ; this . isOverlay = true ; config . setTransition ( 'loading-pop-in' , LoadingPopIn ) ; config . setTransition ( 'loading-pop-out' , LoadingPopOut ) ; config . setTransition ( 'loading-md-pop-in' , LoadingMdPopIn ) ; config . setTransition ( 'loading-md-pop-out' , LoadingMdPopOut ) ; config . setTransition ( 'loading-wp-pop-in' , LoadingWpPopIn ) ; config . setTransition ( 'loading-wp-pop-out' , LoadingWpPopOut ) ; } hidden getTransitionName ( direction ) { let key = ( direction === 'back' ? 'loadingLeave' : 'loadingEnter' ) ; return this . _nav && this . _nav . config . get ( key ) ; } param { string } content setContent ( content ) { this . data . content = content ; return this ; } param { string } spinner setSpinner ( spinner ) { this . data . spinner = spinner ; return this ; } param { string } cssClass setCssClass ( cssClass ) { this . data . cssClass = cssClass ; return this ; } param { boolean } showBackdrop setShowBackdrop ( showBackdrop ) { this . data . showBackdrop = showBackdrop ; return this ; } param { number } dur setDuration ( dur ) { this . data . duration = dur ; return this ; } param { NavOptions } navOptions returns { Promise } present ( navOptions = { } ) { return this . _app . present ( this , navOptions , PORTAL_LOADING ) ; } /**
     * Dismiss all loading components which have been presented.
     */ dismissAll ( ) { this . _nav && this . _nav . popAll ( ) ; } }