mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-01-30 13:37:35 +00:00
Update react-native-zeroconf types to v0.11 (#41284)
This commit is contained in:
parent
90a56d675d
commit
74fa9e11a4
27
types/react-native-zeroconf/index.d.ts
vendored
27
types/react-native-zeroconf/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for react-native-zeroconf 0.9
|
||||
// Type definitions for react-native-zeroconf 0.11
|
||||
// Project: https://github.com/Apercu/react-native-zeroconf#readme
|
||||
// Definitions by: Peter Matta <https://github.com/mattapet>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@ -80,6 +80,31 @@ export default class Zeroconf extends EventEmitter {
|
||||
*/
|
||||
addDeviceListeners(): void;
|
||||
|
||||
/**
|
||||
* Publish a service.
|
||||
*
|
||||
* @description This adds a service for the current device to the
|
||||
* discoverable services on the network.
|
||||
*
|
||||
* @param type Should be both type of the service, for example 'http'.
|
||||
* @param protocol Should be protocol of the service, for example 'tcp'.
|
||||
* @param domain Should be the domain the service is sitting on, dot
|
||||
* suffixed, for example `'local.'`. Defaults to `'local'`.
|
||||
* @param name should be unique to the device, often the device name.
|
||||
* @param port should be an integer between 0 and 65535.
|
||||
*/
|
||||
publishService(type: string, protocol: string, domain?: string, name?: string, port?: number): void;
|
||||
|
||||
/**
|
||||
* Unpublish a service.
|
||||
*
|
||||
* @description This removes a service from those discoverable on the
|
||||
* network.
|
||||
*
|
||||
* @param name should be the name used when publishing the service.
|
||||
*/
|
||||
unpublishService(name: string): void;
|
||||
|
||||
on(e: 'start' | 'stop' | 'update', listener: () => any): this;
|
||||
|
||||
/**
|
||||
|
||||
@ -11,6 +11,8 @@ zeroconf.on('remove', (name: string) => console.log(`[Remove] '${name}'`));
|
||||
zeroconf.on('update', () => console.log('[Update]'));
|
||||
zeroconf.on('error', (error: Error) => console.log(`[Error] ${error}`));
|
||||
|
||||
zeroconf.publishService('http', 'tcp', 'local.', 'test-device', 3000);
|
||||
|
||||
zeroconf.scan('http', 'tcp', 'local.');
|
||||
const services = zeroconf.getServices();
|
||||
for (const serviceName in services) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user