Skip to content

Commit fd43988

Browse files
author
Florian Treml
committed
No global namespace pollution before actually running
1 parent 93347d7 commit fd43988

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

index.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@ const FormData = require('form-data')
77
const fetch = require('node-fetch')
88
const fs = require('fs')
99
const path = require('path')
10-
11-
global.XMLHttpRequest = require('xhr2')
12-
13-
if (debug.enabled) {
14-
global.window = Object.assign(global.window || {}, { botchatDebug: true })
15-
} else {
16-
global.window = Object.assign(global.window || {}, { botchatDebug: false })
17-
}
10+
const xhr2 = require('xhr2')
1811

1912
const Capabilities = {
2013
DIRECTLINE3_SECRET: 'DIRECTLINE3_SECRET',
@@ -78,6 +71,10 @@ class BotiumConnectorDirectline3 {
7871

7972
Start () {
8073
debug('Start called')
74+
global.XMLHttpRequest = xhr2
75+
if (debug.enabled) {
76+
global.window = Object.assign(global.window || {}, { botchatDebug: true })
77+
}
8178
this._stopSubscription()
8279
this.directLine = new DirectLine({
8380
secret: this.caps.DIRECTLINE3_SECRET,

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "botium-connector-directline3",
3-
"version": "0.0.21",
3+
"version": "0.0.22",
44
"description": "Botium Connector for Bot Framework Direct Line 3 API",
55
"main": "dist/botium-connector-directline3-cjs.js",
66
"module": "dist/botium-connector-directline3-es.js",
@@ -13,12 +13,12 @@
1313
"type": "git",
1414
"url": "git+https://github.com/codeforequity-at/botium-connector-directline3.git"
1515
},
16-
"author": "Florian Treml",
16+
"author": "Botium GmbH",
1717
"license": "MIT",
1818
"bugs": {
1919
"url": "https://github.com/codeforequity-at/botium-connector-directline3/issues"
2020
},
21-
"homepage": "https://github.com/codeforequity-at/botium-connector-directline3#readme",
21+
"homepage": "https://www.botium.ai",
2222
"devDependencies": {
2323
"@babel/core": "^7.8.7",
2424
"@babel/node": "^7.8.7",

samples/convo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"botium": {
88
"convodirs": [
9-
"spec\\convo"
9+
"spec/convo"
1010
],
1111
"expandConvos": true,
1212
"expandUtterancesToConvos": false

0 commit comments

Comments
 (0)