From 6a87253d94639caabe0b22043115ce4b463d08de Mon Sep 17 00:00:00 2001 From: Alexander Olsson Date: Mon, 11 Apr 2016 15:06:40 +0200 Subject: [PATCH] nodejs module definition Allow importing xterm into a nodejs application (for instance an electron application, or perhaps a test environment using phantomjs which also has a DOM), --- src/xterm.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/xterm.js b/src/xterm.js index 42c8b81c..5642bfe7 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -32,7 +32,12 @@ */ (function (xterm) { - if (typeof define == 'function') { + if (typeof exports === 'object' && typeof module === 'object') { + /* + * npm/nodejs project + */ + module.exports = xterm.call(this); + } else if (typeof define == 'function') { /* * Require.js is available */