[noble] add missing noble.removeListener functions and noble.state variable

This commit is contained in:
Michal Lower
2017-09-14 20:59:02 +02:00
committed by Michal Lower
parent acc37d8b9d
commit f8f7d97487
2 changed files with 17 additions and 0 deletions
+9
View File
@@ -5,6 +5,7 @@
// Shantanu Bhadoria <https://github.com/shantanubhadoria>
// Luke Libraro <https://github.com/lukel99>
// Dan Chao <https://github.com/bioball>
// Michal Lower <https://github.com/keton>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -23,6 +24,14 @@ export declare function on(event: "scanStart", listener: () => void): events.Eve
export declare function on(event: "scanStop", listener: () => void): events.EventEmitter;
export declare function on(event: "discover", listener: (peripheral: Peripheral) => void): events.EventEmitter;
export declare function removeListener(event: string, listener: Function): events.EventEmitter;
export declare function removeListener(event: "stateChange", listener: (state: string) => void): events.EventEmitter;
export declare function removeListener(event: "scanStart", listener: () => void): events.EventEmitter;
export declare function removeListener(event: "scanStop", listener: () => void): events.EventEmitter;
export declare function removeListener(event: "discover", listener: (peripheral: Peripheral) => void): events.EventEmitter;
export declare var state:string;
export declare class Peripheral extends events.EventEmitter {
id: string;
uuid: string;
+8
View File
@@ -27,6 +27,14 @@ noble.on("discover", (peripheral: noble.Peripheral): void => {
peripheral.disconnect((): void => {});
});
noble.removeListener("stateChange", (state: string): void => {});
noble.removeListener("scanStart", (): void => {});
noble.removeListener("scanStop", (): void => {});
noble.removeListener("discover", (peripheral: noble.Peripheral): void => {
peripheral.connect((error: string): void => {});
peripheral.disconnect((): void => {});
});
var peripheral: noble.Peripheral = new noble.Peripheral();
peripheral.uuid = "12ad4e81";
peripheral.advertisement = {