Skip to content

Commit 25aa133

Browse files
authored
Merge pull request #35 from tobybrad/master
Add section on XMLHttpRequest for Node to README
2 parents 3117982 + 8b54d2d commit 25aa133

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ There are several ways:
4040
2. Use the unpkg CDN, e.g. `<script src="http://unpkg.com/botframework-directlinejs/directLine.js"/>`
4141
3. `npm install botframework-directlinejs`
4242

43+
## Using from within a Node environment
44+
45+
This library uses RxJs/AjaxObserverable which is meant for use in a DOM environment. That doesn't mean you can't also use it from Node though, you just need to do a couple of extra things:
46+
47+
1. `npm install --save xhr2`
48+
2. Add the following towards the top of your main application file:
49+
50+
```typescript
51+
global.XMLHttpRequest = require("xhr2");
52+
```
53+
4354
## How to create and use a directLine object
4455

4556
### Obtain security credentials for your bot:

0 commit comments

Comments
 (0)