]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Make all add-ons CommonJS importable
authorParis <paris@sourcelair.com>
Tue, 3 May 2016 09:05:13 +0000 (12:05 +0300)
committerParis <paris@sourcelair.com>
Tue, 3 May 2016 09:05:13 +0000 (12:05 +0300)
- Fix #52
- Rename `npm/nodejs project` documentation to `CommonJS environment`

addons/attach/attach.js
addons/fit/fit.js
addons/fullscreen/fullscreen.js
addons/linkify/linkify.js
src/xterm.js

index e2ce145f1521fcec3b40a66a170ed038cc476c9c..2788f8e745662cb79ae2ecb078eb7230d2ed05de 100644 (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
          */
index f913d4eac9acb15a0bab333c6600c36f89967fba..c39b9cf151f40091dc859225f4d840ceef8a0aa4 100644 (file)
  *               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
          */
index 4816e951ee59b2c242cac8bde030cd3d4ce5dfee..4e3d00283c253708ba411f818a640a2751ca2a65 100644 (file)
  * 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');
     };
-});
\ No newline at end of file
+});
index 9834183b336ec6d221edaad8f32e1da051210acb..ab3c041a9b839e39ceaea901cc1f993615b99255 100644 (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
          */
index 69b645117e39f8703ff306a8dc48975ec6000f8d..6bec2030ef0d4eeab64d5cbe65f84c4ee3791ab4 100644 (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') {