mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-18 12:33:17 +08:00
Merge pull request #12149 from fjmorel/types-2.0
Add types for node-hue-api npm package
This commit is contained in:
1070
node-hue-api/index.d.ts
vendored
Normal file
1070
node-hue-api/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22
node-hue-api/node-hue-api-tests.ts
Normal file
22
node-hue-api/node-hue-api-tests.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/// <reference path="index.d.ts" />
|
||||
|
||||
import hue = require('node-hue-api');
|
||||
|
||||
hue.nupnpSearch().then(function (bridges) {
|
||||
if (!bridges || !bridges[0]) {
|
||||
throw "No bridge found";
|
||||
}
|
||||
let ip = bridges[0].ipaddress;
|
||||
//First load username from file. Register if there's no file.
|
||||
let api = new hue.HueApi();
|
||||
api.registerUser(ip).then(newUser => {
|
||||
console.log("Created Hue user: " + JSON.stringify(newUser));
|
||||
}).then(listScenes.bind(this, api));
|
||||
})
|
||||
|
||||
|
||||
function listScenes(api: hue.HueApi) {
|
||||
return api.getScenes().then(function (scenes) {
|
||||
return console.log(scenes.map(s => s.name).join(", "));
|
||||
});
|
||||
}
|
||||
19
node-hue-api/tsconfig.json
Normal file
19
node-hue-api/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-hue-api-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user