Permalink
Browse files

fix(rest): only set up global if it exists (eg, Node.js, not browser)

  • Loading branch information...
RangerRick committed Jul 27, 2017
1 parent 14a9219 commit 7a1b2c37172016fad666cb68339c59b228cec19d
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/rest/AbstractHTTP.ts
View
@@ -8,12 +8,12 @@ import {OnmsHTTPOptions} from '../api/OnmsHTTPOptions';
import {OnmsResult} from '../api/OnmsResult';
import {OnmsServer} from '../api/OnmsServer';
if (!global.window) {
if (global && !global.window) {
global.window = {} as Window;
}
if (!global.window.DOMParser) {
// tslint:disable-next-line
global.window.DOMParser = require('xmldom').DOMParser;
if (!global.window.DOMParser) {
// tslint:disable-next-line
global.window.DOMParser = require('xmldom').DOMParser;
}
}
/** @hidden */

0 comments on commit 7a1b2c3

Please sign in to comment.