Skip to content

Commit

Permalink
Add import and require to README.md
Browse files Browse the repository at this point in the history
Closes #89
  • Loading branch information
WesSouza committed Feb 27, 2023
1 parent f09c2df commit 271d44c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Before anything, you need to enable Network IP Control, which is very easy:
Here's a very basic example of how to control the TV:

```ts
import { LGTV } from 'lgtv-ip-control';

const tv = new LGTV('192.168.1.100', '1a:2b:3c:4d:5e:6f', 'KEY1C0DE');

tv.connect()
Expand All @@ -58,6 +60,14 @@ tv.connect()
.catch(console.error);
```

To use `import`, you need to make sure to save the file as `.mjs` or to specify `"type": "module"` on your `package.json`. [Learn more about Node.js' support for ESM.](https://nodejs.org/api/esm.html)

Otherwise replace the first line with:

```js
const { LGTV } = require('lgtv-ip-control');
```

### `new LGTV()`

Returns a new instance to control a TV.
Expand Down

0 comments on commit 271d44c

Please sign in to comment.