Skip to content

Commit f86979d

Browse files
committed
fix d.ts
1 parent 30355cd commit f86979d

File tree

2 files changed

+62
-50
lines changed

2 files changed

+62
-50
lines changed

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ Of course I'm also very glad about issues and pull requests if you find a bug /
173173
Placeholder for next versions (this needs to be indented):
174174
### __WORK IN PROGRESS__
175175
-->
176+
### __WORK IN PROGRESS__
177+
* fix d.ts
178+
176179
### 0.5.2 (2023-04-17)
177180
* add d.ts for typescript support.
178181

Diff for: index.d.ts

+59-50
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,62 @@
11
import {EventEmitter} from 'events';
22

3-
declare module 'dlink_websocketclient' {
4-
class WebSocketClient extends EventEmitter.EventEmitter {
5-
constructor(options: {
6-
/**
7-
* ip of device as string
8-
*/
9-
ip: string
10-
/**
11-
* either Pin on the back or device token (if paired with App! Needs to be extracted, see readme).
12-
*/
13-
pin: string;
14-
15-
/**
16-
* defaults to 8080
17-
*/
18-
port?: number;
19-
20-
/**
21-
* either w115 or w245.
22-
*/
23-
model?: string;
24-
25-
/**
26-
* function for debug logging, defaults to noop.
27-
*/
28-
log?: (string) => void;
29-
30-
/**
31-
* seconds to ping, defaults to 30. 0 to turn off.
32-
*/
33-
keepAlive?: number;
34-
35-
/**
36-
* library should get the device token from telnet (which needs to be active).
37-
*/
38-
useTelnetForToken?: boolean;
39-
});
40-
41-
connect(): Promise<boolean>;
42-
disconnect(): void;
43-
getDeviceId(): string;
44-
getDeviceInfoFromTelnet(): Promise<Record<string, string>>;
45-
getTokenFromTelnet(): Promise<boolean>;
46-
login(): Promise<boolean>;
47-
setPin(newPin: string): void;
48-
isDeviceReady(): boolean;
49-
switch(on: boolean, socket: number): Promise<boolean>;
50-
switchLED(on: boolean, socket: number): Promise<boolean>;
51-
state(socket: number): Promise<boolean>;
52-
}
3+
export = WebSocketClient;
4+
declare class WebSocketClient extends EventEmitter.EventEmitter {
5+
constructor(options: {
6+
/**
7+
* ip of device as string
8+
*/
9+
ip: string
10+
/**
11+
* either Pin on the back or device token (if paired with App! Needs to be extracted, see readme).
12+
*/
13+
pin: string;
14+
15+
/**
16+
* defaults to 8080
17+
*/
18+
port?: number;
19+
20+
/**
21+
* either w115 or w245.
22+
*/
23+
model?: string;
24+
25+
/**
26+
* function for debug logging, defaults to noop.
27+
*/
28+
log?: (string) => void;
29+
30+
/**
31+
* seconds to ping, defaults to 30. 0 to turn off.
32+
*/
33+
keepAlive?: number;
34+
35+
/**
36+
* library should get the device token from telnet (which needs to be active).
37+
*/
38+
useTelnetForToken?: boolean;
39+
});
40+
41+
connect(): Promise<boolean>;
42+
43+
disconnect(): void;
44+
45+
getDeviceId(): string;
46+
47+
getDeviceInfoFromTelnet(): Promise<Record<string, string>>;
48+
49+
getTokenFromTelnet(): Promise<boolean>;
50+
51+
login(): Promise<boolean>;
52+
53+
setPin(newPin: string): void;
54+
55+
isDeviceReady(): boolean;
56+
57+
switch(on: boolean, socket?: number): Promise<boolean>;
58+
59+
switchLED(on: boolean, led?: number): Promise<boolean>;
60+
61+
state(socket?: number): Promise<boolean | Array<boolean> >;
5362
}

0 commit comments

Comments
 (0)