UI for Zipcoin Blue

index.js 851B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * window-size
  3. * https://github.com/jonschlinkert/window-size
  4. *
  5. * Copyright (c) 2014 Jon Schlinkert
  6. * Licensed under the MIT license.
  7. */
  8. const tty = require('tty')
  9. module.exports = (function() {
  10. var width;
  11. var height;
  12. if(tty.isatty(1) && tty.isatty(2)) {
  13. if(process.stdout.getWindowSize) {
  14. width = process.stdout.getWindowSize(1)[0];
  15. height = process.stdout.getWindowSize(1)[1];
  16. } else if (tty.getWindowSize) {
  17. width = tty.getWindowSize()[1];
  18. height = tty.getWindowSize()[0];
  19. } else if (process.stdout.columns && process.stdout.rows) {
  20. height = process.stdout.columns;
  21. width = process.stdout.rows;
  22. }
  23. } else {
  24. new Error('Error: could not get window size with tty or process.stdout');
  25. }
  26. return {
  27. height: height,
  28. width: width
  29. }
  30. })();