import { ServiceScope , ServiceKey } from '@microsoft/sp-core-library' ; export class ServiceScopeHelper { param serviceKey public static registerChildServices ( rootScope , serviceKeys ) { let childScope = null ; if ( rootScope ) { childScope = rootScope . startNewChild ( ) ; serviceKeys . forEach ( serviceKey => { childScope . createDefaultAndProvide ( serviceKey ) ; } ) ; childScope . finish ( ) ; } return childScope ; } param scope returns public static getRootServiceScope ( scope ) { let rootServiceScope ; let parentScope = scope . getParent ( ) ; while ( parentScope !== undefined ) { rootServiceScope = parentScope ; parentScope = parentScope . getParent ( ) ; } return rootServiceScope ; } }