Fix import for CommonJS consumers

CommonJS now imports the Terminal object directly as the trick in xterm.ts
wasn't working properly.

Fixes #865
This commit is contained in:
Daniel Imms
2017-08-08 00:24:41 -07:00
parent a0ce9a79a9
commit 3b787824d3
9 changed files with 44 additions and 32 deletions
+6 -6
View File
@@ -9,7 +9,7 @@
/*
* CommonJS environment
*/
module.exports = attach(require('../../xterm'));
module.exports = attach(require('../../Terminal').Terminal);
} else if (typeof define == 'function') {
/*
* Require.js is available
@@ -21,7 +21,7 @@
*/
attach(window.Terminal);
}
})(function (Xterm) {
})(function (Terminal) {
'use strict';
var exports = {};
@@ -29,7 +29,7 @@
/**
* Attaches the given terminal to the given socket.
*
* @param {Xterm} term - The terminal to be attached to the given socket.
* @param {Terminal} term - The terminal to be attached to the given socket.
* @param {WebSocket} socket - The socket to attach the current terminal.
* @param {boolean} bidirectional - Whether the terminal should send data
* to the socket as well.
@@ -82,7 +82,7 @@
/**
* Detaches the given terminal from the given socket
*
* @param {Xterm} term - The terminal to be detached from the given socket.
* @param {Terminal} term - The terminal to be detached from the given socket.
* @param {WebSocket} socket - The socket from which to detach the current
* terminal.
*/
@@ -108,7 +108,7 @@
* should happen instantly or at a maximum
* frequency of 1 rendering per 10ms.
*/
Xterm.prototype.attach = function (socket, bidirectional, buffered) {
Terminal.prototype.attach = function (socket, bidirectional, buffered) {
return exports.attach(this, socket, bidirectional, buffered);
};
@@ -118,7 +118,7 @@
* @param {WebSocket} socket - The socket from which to detach the current
* terminal.
*/
Xterm.prototype.detach = function (socket) {
Terminal.prototype.detach = function (socket) {
return exports.detach(this, socket);
};