How to use the Box function from blessed

Find comprehensive JavaScript blessed.Box code examples handpicked from public code repositorys.

14
15
16
17
18
19
20
21
22
23
24
25


function checkHighscore({ game, screen }) {
    const lowestScore = highscores.reduce((a, b) => Math.min(a, b.score), Infinity);


    if (highscores.length < 10 || game.score > lowestScore) {
        const prompt = new Box({
            parent: screen,
            width: 40,
            height: `shrink`,
            border: 'line',
fork icon2
star icon44
watch icon0

29
30
31
32
33
34
35
36
37
38
    },
    bottom: 0,
    left: 'center',
});

const title = new Box({
    parent: screen,
    width: 'shrink',
    height: 3,
    content: '',
fork icon2
star icon44
watch icon0

+ 5 other calls in file

21
22
23
24
25
26
27
28
29
30
    self.focus()
    self.screen.render()
  })
}

ChatBox.prototype.__proto__ = blessed.Box.prototype
ChatBox.prototype.type = 'chatbox'
ChatBox.prototype.add = ChatBox.prototype.log = function(){
  var text = Array.prototype.slice.call(arguments).join(' ')
  this.pushLine(text)
fork icon2
star icon32
watch icon2

+ 17 other calls in file

-2
fork icon7
star icon25
watch icon5

+ 6 other calls in file

0
1
2
3
4
5
6
7
8
9
10
11
const util = require('util');
const { Screen, Box, BigText, FileManager, Text, Button } = require('blessed');


module.exports = function (screen) {


    const container = new Box({
        parent: screen,
        left: 0,
        bottom: 0,
        height: '50%',
fork icon2
star icon8
watch icon0

-3
fork icon1
star icon1
watch icon2

+ 142 other calls in file

2
3
4
5
6
7
8
9
10
11
12
// dependencies
var blessed = require('blessed');
// Contrib = require('blessed-contrib'),
// ContribTable = Contrib.table,
var ContribTable = require('./blessed-contrib/table');
var BlessedBox = blessed.Box;


// project includes
// var {SummaryTableConfig} = require('./widget_SummaryListTable');
var {TimetrapTUI_Error} = require('./Errors');
fork icon1
star icon1
watch icon2

+ 43 other calls in file

2
3
4
5
6
7
8
9
10
11
12
// dependencies
var blessed = require('blessed');
// Contrib = require('blessed-contrib'),
// ContribTable = Contrib.table;
var ContribTable = require('./blessed-contrib/table');
// BlessedBox = blessed.Box;


// project includes
// var {SummaryTableConfig} = require('./widget_SummaryListTable');
var {TimetrapTUI_Error} = require('./Errors');
fork icon1
star icon1
watch icon2

+ 17 other calls in file

1
2
3
4
5
6
7
8
9
10
11
// I've just made a couple of modifications.
// TODO: Get this upstreamed
"use strict";
var blessed = require('blessed'),
  Node = blessed.Node,
  Box = blessed.Box;


function Tree(options) {
  if (!(this instanceof Node)) {
    return new Tree(options);
fork icon0
star icon5
watch icon2

+ 4 other calls in file

-2
fork icon0
star icon4
watch icon1

+ 17 other calls in file

371
372
373
374
375
376
377
378
379
380

if (this.style.transparent) {
    options.transparent = true;
}

var item = new blessed.Box(options);

item.dattr = item.sattr({ fg: 'white', bg: 'black' });

item.itemName = typeof content === 'object' ? content.name : content;
fork icon0
star icon0
watch icon0

47
48
49
50
51
52
53
54
55
56

if (this.style.transparent) {
  options.transparent = true;
}

var item = new Box(options);

if (this.mouse) {
  item.on('click', function() {
    self.focus();
fork icon0
star icon0
watch icon0