import { Zeroconf } from '@ionic-native/zeroconf' ; import { Observable } from 'rxjs/Observable' ; import { Observer } from 'rxjs/Observer' ; export interface ZeroconfService { domain : string ; type : string ; name : string ; port : number ; hostname : string ; ipv4Addresses : Array < string > ; ipv6Addresses : Array < string > ; txtRecord : any ; } export interface ZeroconfResult { action : 'registered' | 'added' | 'removed' ; service : ZeroconfService ; } export class ZeroconfMock extends Zeroconf { return { Promise < string > } getHostname ( ) { let response = '' ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param type { string } param domain { string } param name { string } param port { number } param txtRecord { any } return { Promise < ZeroconfResult > } register ( type , domain , name , port , txtRecord ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param type { string } param domain { string } param name { string } return { Promise < void > } unregister ( type , domain , name ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; return { Promise < void > } stop ( ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; param type { string } param domain { string } return { Observable < ZeroconfResult > } watch ( type , domain ) { let response ; return Observable . create ( ( observer ) => { observer . next ( response ) ; observer . complete ( ) ; } ) ; } ; param type { string } param domain { string } return { Promise < void > } unwatch ( type , domain ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; return { Promise < void > } close ( ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; }