How to use the blessed-contrib.carousel function in blessed-contrib

To help you get started, we’ve selected a few blessed-contrib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github astefanutti / kubebox / kubebox.js View on Github external
// TODO: watch for namespace changes when the selection list is open
  // and avoid 'n' key to trigger another request
  get(session.openshift ? get_projects() : get_namespaces())
    .then(response => JSON.parse(response.body.toString('utf8')))
    // TODO: display a message in case the user has access to no namespaces
    .then(namespaces => session.namespaces = namespaces)
    .then(namespaces => namespaces_list.setItems(namespaces.items.reduce((data, namespace) => {
      data.push(namespace.metadata.name === session.namespace ?
        `{blue-fg}${namespace.metadata.name}{/blue-fg}` : namespace.metadata.name);
      return data;
    }, [])))
    .then(() => screen.render())
    .catch(error => console.error(error.stack));
});

const carousel = new contrib.carousel(
  [
    screen => {
      // TODO: restore selection if any
      screen.append(pods_table);
      screen.append(pod_log);
      pod_log.setScrollPerc(100);
      pods_table.focus();
    },
    screen => {
      screen.append(debug);
      debug.setScrollPerc(100);
    }
  ],
  {
    screen      : screen,
    interval    : 0,
github crazyguitar / noslide.js / lib / slide.js View on Github external
.then(boxes => {
    /* put boxes into carousel */
    var carousel = new contrib.carousel(boxes
                                       , { screen: this.screen
                                         , interval: 0
                                         , rotate: false
                                         , controlKeys: true });
    carousel.start();
  })
  .catch(e => {
github dundalek / react-blessed-contrib / src / index.js View on Github external
componentDidMount() {
    this.carousel = new contrib.carousel(this.props.children, this.props);
    this.carousel.move = () => {
      this.setState({
        page: this.carousel.currPage
      });
    }
    this.carousel.start();
  }