Beispiel #1
0
  /**
   * Bootstraps a {@link Board} from a {@link BoardDef Board Definition}
   * @param {BoardDef} opts Board Definition
   * @param {?string} [id] Unique ID of board, if string
   * @returns {Board} New Board instance
   */
  createBoard(opts, id) {
    id = opts.id = (_.isString(id) && id) || opts.id || null;

    debug('%s: creating <%s#%s> w/ options:', this, Board.name, id, opts);

    let board = new Board(this, opts);
    pipeEvent('error', board, this);
    return board;
  }
Beispiel #2
0
 .then(function () {
   if (_.isUndefined(board)) {
     debug('%s: starting all (%d) Boards', this, _.size(this.boards));
     return Promise.settle(_.map(this.boards, function (boardObj) {
       return boardObj.start()
         .bind(this)
         .catch(function (err) {
           this.warn(err);
         });
     }, this));
   }
   else if (_.isString(board)) {
     debug('%s: found Board with ID "%s"', this, board);
     board = this.boards[board];
   }
   else if (!(board instanceof Board)) {
     debug('%s: creating <%s#%s> from object:', this, Board.name, id,
       board);
     this.boards[board.id] = board = this.createBoard(board, id);
   }
   debug('%s: starting <%s#%s>', this, Board.name, board.id);
   return board.start();
 });