import { ProviderInterface } from '@polkadot/rpc-provider/types' ; import { Observable } from 'rxjs' ; param provider export function providerConnected ( provider ) { return new Observable ( subscriber => { if ( provider . isConnected ( ) ) { subscriber . next ( true ) ; } else { subscriber . next ( false ) ; } provider . on ( 'connected' , ( ) => { subscriber . next ( true ) ; } ) ; provider . on ( 'disconnected' , ( ) => { subscriber . next ( false ) ; } ) ; } ) ; }