From 73c6caaa7725da5cf8bfa566b1fc208c92eda6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marti=CC=81n=20M?= Date: Wed, 26 Jun 2019 21:28:34 -0300 Subject: [PATCH] added demo script --- demo/example.js | 19 +++++++++++++++++++ package.json | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 demo/example.js diff --git a/demo/example.js b/demo/example.js new file mode 100644 index 0000000..51cfe12 --- /dev/null +++ b/demo/example.js @@ -0,0 +1,19 @@ +const ewelink = require('../main'); + +(async () => { + const conn = new ewelink({ + email: '', + password: '', + }); + + /* get all devices */ + const devices = await conn.getDevices(); + console.log(devices); + + /* get specific devide info */ + const device = await conn.getDevice(''); + console.log(device); + + /* toggle device */ + await conn.toggleDevice(''); +})(); diff --git a/package.json b/package.json index 74827c5..8981ef7 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "eWeLink API for Node.js", "main": "main.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "demo": "node ./demo/example.js" }, "author": "Martín M.", "license": "MIT",