-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathindex.js
95 lines (90 loc) · 3.08 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// homebridge-lib/index.js
//
// Library for Homebridge plugins.
// Copyright © 2017-2025 Erik Baauw. All rights reserved.
/** Library for Homebridge plugins.
* see the {@tutorial homebridge-lib} tutorial.
*
* Homebridge Lib provides:
* - A series of base classes for building Homebridge dynamic platform plugins:
* {@link Platform},
* {@link AccessoryDelegate},
* {@link ServiceDelegate}, and
* {@link CharacteristicDelegate}.
* - An abstract base class to building command-line tools:
* {@link CommandLineTool}.
* - A series of helper classes for building homebridge plugins (of any type)
* and/or command-line utilities:
* {@link AdaptiveLighting},
* {@link Colour},
* {@link CommandLineParser},
* {@link CustomHomeKitTypes},
* {@link Delegate},
* {@link EveHomeKitTypes},
* {@link HttpClient},
* {@link JsonFormatter},
* {@link MyHomeKitTypes},
* {@link OptionParser},
* {@link PropertyDelegate},
* {@link SystemInfo},
* {@link UiServer}, and
* {@link UpnpClient}.
*
* To access the classes provided by Homebridge Lib from your module,
* simply load it by:
* ```javascript
* import { Class } from 'homebridge-lib/Class'
* ```
*
* Note that each class provided by Homebridge Lib is implemented as a
* separate Javascript module, that is loaded lazily on first use.
* Due to the way NodeJS deals with circular module dependencies, these modules
* might not yet be initialised while your module is loading.
*
* @module homebridge-lib
*/
/** Convert Error to string.
*
* Include the stack trace only for programming errors (JavaScript and NodeJS
* runtime errors).
* Translate system errors into more readable messages.
* @function formatError
* @param {Error} e - The error.
* @param {boolean} [useChalk=false] - Use chalk to grey out the stack trace.
* @returns {string} - The error as string.
* @memberof module:homebridge-lib
*/
export { formatError } from 'hb-lib-tools'
/** Return the recommended version of NodeJS from package.json.
* This is the version used to develop and test the software,
* typically the latest LTS version.
* @function recommendedNodeVersion
* @param {string} packageJson - The contents of package.json
* #return {string} - The recommended version.
* @memberof module:hbLibTools
*/
export { recommendedNodeVersion } from 'hb-lib-tools'
/** Resolve after given period, delaying execution.
*
* E.g. to delay execution for 1.5 seconds, issue:
* ```javascript
* import { timeout } from 'homebridge-lib'
*
* await timeout(1500)
* ```
*
* @function timeout
* @param {integer} msec - Period (in msec) to wait.
* @throws {TypeError} On invalid parameter type.
* @throws {RangeError} On invalid parameter value.
* @memberof module:homebridge-lib
*/
export { timeout } from 'hb-lib-tools'
/** Convert integer to hex string.
* @function toHexString
* @param {integer} i - The integer.
* @param {integer} [length=4] - The number of digits in the hex string.
* @returns {string} - The hex string.
* @memberof module:homebridge-lib
*/
export { toHexString } from 'hb-lib-tools'