Make all add-ons CommonJS importable

- Fix #52
- Rename `npm/nodejs project` documentation to `CommonJS environment`
This commit is contained in:
Paris
2016-05-03 12:05:13 +03:00
parent 537fbad705
commit bd2158613d
5 changed files with 27 additions and 7 deletions
+6 -1
View File
@@ -7,7 +7,12 @@
*/
(function (attach) {
if (typeof define == 'function') {
if (typeof exports === 'object' && typeof module === 'object') {
/*
* CommonJS environment
*/
module.exports = attach.call(this);
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
+6 -1
View File
@@ -12,7 +12,12 @@
* of columns)
*/
(function (fit) {
if (typeof define == 'function') {
if (typeof exports === 'object' && typeof module === 'object') {
/*
* CommonJS environment
*/
module.exports = fit.call(this);
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
+8 -3
View File
@@ -11,7 +11,12 @@
* fullscreen mode is being toggled.
*/
(function (fullscreen) {
if (typeof define == 'function') {
if (typeof exports === 'object' && typeof module === 'object') {
/*
* CommonJS environment
*/
module.exports = fullscreen.call(this);
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
@@ -19,7 +24,7 @@
} else {
/*
* Plain browser environment
*/
*/
fullscreen(this.Xterm);
}
})(function (Xterm) {
@@ -36,4 +41,4 @@
this.element.classList[fn]('fullscreen');
};
});
});
+6 -1
View File
@@ -1,5 +1,10 @@
(function (linkify) {
if (typeof define == 'function') {
if (typeof exports === 'object' && typeof module === 'object') {
/*
* CommonJS environment
*/
module.exports = linkify.call(this);
} else if (typeof define == 'function') {
/*
* Require.js is available
*/
+1 -1
View File
@@ -34,7 +34,7 @@
(function (xterm) {
if (typeof exports === 'object' && typeof module === 'object') {
/*
* npm/nodejs project
* CommonJS environment
*/
module.exports = xterm.call(this);
} else if (typeof define == 'function') {