Merge pull request #17750 from bioball/fix-noble-typings

noble: add subscribe and unsubscribe methods to peripherals
This commit is contained in:
Ron Buckton
2017-07-04 11:54:15 -07:00
committed by GitHub
2 changed files with 7 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
// Hans Bakker <https://github.com/wind-rider>
// Shantanu Bhadoria <https://github.com/shantanubhadoria>
// Luke Libraro <https://github.com/lukel99>
// Dan Chao <https://github.com/bioball>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -88,6 +89,8 @@ export declare class Characteristic extends events.EventEmitter {
notify(notify: boolean, callback?: (error: string) => void): void;
discoverDescriptors(callback?: (error: string, descriptors: Descriptor[]) => void): void;
toString(): string;
subscribe(callback?: (error: string) => void): void;
unsubscribe(callback?: (error: string) => void): void;
on(event: string, listener: Function): this;
on(event: string, option: boolean, listener: Function): this;

View File

@@ -87,6 +87,10 @@ characteristic.on("write", true, (error: string): void => {});
characteristic.on("broadcast", (state: string): void => {});
characteristic.on("notify", (state: string): void => {});
characteristic.on("descriptorsDiscover", (descriptors: noble.Descriptor[]): void => {});
characteristic.subscribe();
characteristic.subscribe((error: string) => {});
characteristic.unsubscribe();
characteristic.unsubscribe((error: string) => {});
var descriptor: noble.Descriptor = new noble.Descriptor();
descriptor.uuid = "";