import { Injectable , Provider } from '@angular/core' ; export type Async < T > = ( ) => Promise < T > ; @ Injectable ( ) export class ResourceLoader { load < T > ( sync , async , defaultValue ? ) { if ( ! ! sync ) { return Promise . resolve ( sync ) ; } else if ( ! ! async ) { return Promise . resolve ( async ( ) ) ; } return Promise . resolve ( defaultValue ) ; } } export const RESOURCE_LOADER_PROVIDERS = [ new Provider ( ResourceLoader , { useClass : ResourceLoader } ) ] ;