import { EventEmitter } from 'events' ; import { InspectorViewDescription } from './types' ; import { Adapters } from '../common' ; callback viewShouldShowFunc param { object } adapters returns { boolean } /**
 * A registry that will hold inspector views.
 */ export class InspectorViewRegistry extends EventEmitter { private views : InspectorViewDescription [ ] = [ ] ; param { InspectorViewDescription } view public register ( view ) { if ( ! view ) { return ; } this . views . push ( view ) ; this . views . sort ( ( a , b ) => ( a . order || Number . MAX_VALUE ) - ( b . order || Number . MAX_VALUE ) ) ; this . emit ( 'change' ) ; } returns { InspectorViewDescription [ ] } public getAll ( ) { return this . views ; } param { object } adapters returns { InspectorViewDescription [ ] } public getVisible ( adapters ? ) { if ( ! adapters ) { return [ ] ; } return this . views . filter ( ( view ) => ! view . shouldShow || view . shouldShow ( adapters ) ) ; } }