## WaitingRoom constructor

Instantiates a new WaitingRoom object

@param {object} options
512263
function WaitingRoom(options) {

        /**
         * ### WaitingRoom.connected
         *
         * Number of players connected
         */
        this.connected = 0;

        /**
         * ### WaitingRoom.poolSize
         *
         * Number of players connected before groups are made
         */
        this.poolSize = 0;

        /**
         * ### WaitingRoom.nGames
         *
         * Total number of games to be dispatched
         *
         * Server will close the waiting room afterwards.
         *
         * Undefined means no limit.
         */
        this.nGames = undefined;

        /**
         * ### WaitingRoom.groupSize
         *
         * The size of the group
         */
        this.groupSize = 0;

        /**
         * ### WaitingRoom.waitTime
         *
         * The time in milliseconds for the timeout to expire
         */
        this.waitTime = null;

        /**
         * ### WaitingRoom.executionMode
         *
         * The execution mode.
         */
        this.executionMode = null;

        /**
         * ### WaitingRoom.startDate
         *
         * The exact date and time when the game starts
         */
        this.startDate = null;

        /**
         * ### WaitingRoom.timeoutId
         *
         * The id of the timeout, if created
         */
        this.timeoutId = null;

        /**
         * ### WaitingRoom.execModeDiv
         *
         * Div containing the span for displaying the number of players
         *
         * @see WaitingRoom.playerCount
         */
        this.execModeDiv = null;

        /**
         * ### WaitingRoom.playerCount
         *
         * Span displaying the number of connected players
         */
        this.playerCount = null;

        /**
         * ### WaitingRoom.startDateDiv
         *
         * Div containing the start date
         */
        this.startDateDiv = null;

        /**
         * ### WaitingRoom.msgDiv
         *
         * Div containing optional messages to display
         */
        this.msgDiv = null;

        /**
         * ### WaitingRoom.timerDiv
         *
         * Div containing the timer
         *
         * @see WaitingRoom.timer
         */
        this.timerDiv = null;

        /**
         * ### WaitingRoom.timer
         *
         * VisualTimer instance for max wait time.
         *
         * @see VisualTimer
         */
        this.timer = null;

        /**
         * ### WaitingRoom.dots
         *
         * Looping dots to give the user the feeling of code execution
         */
        this.dots = null;

        /**
         * ### WaitingRoom.onTimeout
         *
         * Callback to be executed if the timer expires
         */
        this.onTimeout = null;

        /**
         * ### WaitingRoom.disconnectIfNotSelected
         *
         * Flag that indicates whether to disconnect an not selected player
         */
        this.disconnectIfNotSelected = null;

        /**
         * ### WaitingRoom.playWithBotOption
         *
         * If TRUE, it displays a button to begin the game with bots
         *
         * This option is set by the server, local modifications will
         * not have an effect if server does not allow it
         *
         * @see WaitingRoom.playBotBtn
         */
        this.playWithBotOption = null;

        /**
         * ### WaitingRoom.playBotBtn
         *
         * Reference to the button to play with bots
         *
         * Will be created if requested by options.
         *
         * @see WaitingRoom.playWithBotOption
         */
        this.playBotBtn = null;

        /**
         * ### WaitingRoom.selectTreatmentOption
         *
         * If TRUE, it displays a selector to choose the treatment of the game
         *
         * This option is set by the server, local modifications will
         * not have an effect if server does not allow it
         */
        this.selectTreatmentOption = null;

        /**
         * ### WaitingRoom.treatmentBtn
         *
         * Holds the name of selected treatment
         *
         * Only used if `selectTreatmentOption` is enabled
         *
         * @see WaitingRoom.selectTreatmentOption
         */
        this.selectedTreatment = null;

    }
501562
function Storage(mongoURI, mongoOptions, storageOptions) {
  if (!(this instanceof Storage)) {
    return new Storage(mongoURI, mongoOptions, storageOptions);
  }

  assert(typeof mongoOptions === 'object', 'Invalid mongo options supplied');

  this._uri = mongoURI;
  this._options = mongoOptions;

  const defaultLogger = {
    info: console.log,
    debug: console.log,
    error: console.error,
    warn: console.warn
  };
  this._log = defaultLogger;
  if (storageOptions && storageOptions.logger) {
    this._log = storageOptions.logger;
  }

  // connect to the database
  this._connect();
}
1317513
function _initStorage(options) {
        var self = this;
        var dbInfo = {
            db: null
        };

        if (options) {
            for (var i in options) {
                dbInfo[i] = options[i];
            }
        }

        return new Promise(function(resolve, reject) {
            var openreq = indexedDB.open(dbInfo.name, dbInfo.version);
            openreq.onerror = function() {
                reject(openreq.error);
            };
            openreq.onupgradeneeded = function() {
                // First time setup: create an empty object store
                openreq.result.createObjectStore(dbInfo.storeName);
            };
            openreq.onsuccess = function() {
                dbInfo.db = openreq.result;
                self._dbInfo = dbInfo;
                resolve();
            };
        });
    }
687993
function constructor(options) {
    Pagelet.prototype.constructor.call(this, options = options || {});

    //
    // Store the provided global dependencies.
    //
    this.dependencies = this._bigpipe._compiler.page(this).concat(
      options.dependencies
    );

    var req = options.req || {}
      , uri = req.uri || {}
      , query = req.query || {};

    //
    // Set a number of properties on the response as it is available to all pagelets.
    // This will ensure the correct amount of pagelets are processed and that the
    // entire queue is written to the client.
    //
    this._queue = [];

    //
    // Prepare several properties that are used to render the HTML fragment.
    //
    this.length = options.length || 0;
    this.child = options.child || 'root';
    this.once('contentType', this.contentTypeHeader, this);

    //
    // Set the default fallback script, see explanation above.
    //
    this.debug('Initialized in %s mode', options.mode);
    this.fallback = 'sync' === options.mode ? script : noscript.replace(
      '{path}',
      uri.pathname || 'http://localhost/'
    ).replace(
      '{query}',
      qs.stringify(this.merge({ no_pagelet_js: 1 }, query))
    );
  }
100599
function spawnService(serviceName, type, initWait) {
    // Type can be either service or coreService
    // When coreService, a service from the core-service folder will be spawned
    type = type || 'service';

    // If init wait is set, we will wait for the INITDONE signal before resolving the promise
    initWait = initWait || false;

    // Load the service and return a promise
    return new unicorn.promise(function(resolve, reject){

        if(typeof(serviceName) == 'undefined') reject({msg:'No service name'});

        try {
            // We must fix the hardcoded config path.. or maybe not
            // Maybe change the name of the config to unicorn config and make this default
            var service = Spawn('node', [unicorn.path + '/spawn.js', config.unicornPath + '/config.json', serviceName, type]);

            // Print errors on the console when errors comes in
            service.stderr.on('data', function (data) {
                // Replace newlines, because data is a buffer and will print a newline for free
                console.log(data.toString().replace(/^\s+|\s+$/g, ''));
            });

            // Print info when a process exits
            service.on('close', function (code) {
                console.log('Child process: ' + serviceName + ' exited with code ' + code);
            });

            // Print info when a process exits
            service.on('exit', function (code) {
                console.log('Dirty child process: ' + serviceName + ' exit with code ' + code);
            });

            service.on('error', function (err) {
                console.log('Child process: ' + serviceName + ' error: ' + err);
            });

            // Switch the moment of the resolve, if initWait is enabled we must wait for a return signal
            if(initWait) {
                // Print data on the console when data comes in
                service.stdout.on('data', function (data) {
                    // Replace newlines, because data is a buffer and will print a newline for free
                    var procData = data.toString().replace(/^\s+|\s+$/g, '');

                    // See if we have a system message first, since we cannot use process.send we use std for messaging
                    if (procData == 'INITDONE') {
                        resolve({service: broker, name: broker.name, pid: broker.pid});
                    } else {
                        console.log(procData);
                    }
                });
            } else {
                // Print data on the console when data comes in
                service.stdout.on('data', function (data) {
                    // Replace newlines, because data is a buffer and will print a newline for free
                    console.log(data.toString().replace(/^\s+|\s+$/g, ''));
                });

                resolve({service:service, name:service.name, pid:service.pid});
            }
        } catch (err) {
            reject(err);
        }

    });
}
187837
function Hey(options) {

		// force the use of new
		if (this.constructor !== Hey) {
			throw "Hey must be instantiated with \"new\"!";
		}

		// we need some options, don't we?
		if (!options || !options.path) {
			throw "Option object must be set with a valid path to watch.";
		}

		// start EventEmitter
		EventEmitter.call(this);

		// folders and descriptors, just in case
		this.__paths = [];
		this.__descriptors = [];

		// helpful boolean
		this.__end_of_buffer = false;

		// some filepath properties
		this.__isDirectory = false;
		this.__isFile = false;

		Object.defineProperty(this, "isDirectory", {
			enumerable: true,
			get: function () {
				return this.__isDirectory;
			}
		 });

		Object.defineProperty(this, "isFile", {
			enumerable: true,
			get: function () {
				return this.__isFile;
			}
		 });

		// define options as "property"
		this.__options = options;

		Object.defineProperty(this, "options", {
			enumerable: true,
			get: function () {
				return this.__options;
			}
		 });

		// default mask
		Object.defineProperty(this, "defaultMask", {
			enumerable: true,
			get: function () {
				return Hey.FLAGS.MODIFY | Hey.FLAGS.CREATE | Hey.FLAGS.DELETE
					| Hey.FLAGS.SELF_DELETE | Hey.FLAGS.MOVE
					| Hey.FLAGS.SELF_MOVE;
			}
		});

		this.initialize();
	}
581424
function constructor(options, error, name) {
    Pagelet.prototype.constructor.call(this, options);

    if (name) this.name = name;
    this.data = error instanceof Error ? error : {};
  }
46885
private void init() throws IOException {
    WR = new Path(conf.get("fs.snapshot.waitingroom", "/.WR"));
    WR = WR.makeQualified(dfs);
  }
396802
function _new (args) {
    // instantiate new instance
    var instance = new ImmutableCoreComponentInstance({
        args: args,
        component: this,
    })
    // wait for initialize promise to resolve then resolve with instance
    return instance.promise.then(() => instance)
}
1352268
function constructor(username) {
    /*
     * Set itemsPerPage variable
     *
     * @param Mixed newItemsPerPage
     */

    function setItemsPerPage(newItemsPerPage) {
        itemsPerPage = newItemsPerPage;
    }

    /*
     * Get itemsPerPage variable
     *
     */

    function getItemsPerPage() {
        return itemsPerPage;
    }

    /*
     * Set currentPage variable
     *
     * @param Number newItemsPerPage
     */

    function setCurrentPage(newCurrentPage) {
        currentPage = newCurrentPage;
    }

    /*
     * Get currentPage variable
     *
     */

    function getCurrentPage() {
        return currentPage;
    }

    /*
     * Get all the boards for the user
     *
     * @param boolean paginate
     * @param Function callback
     * @invoke callback(Mixed boards)
     */

    function getBoards(paginate, callback) {
        var boardsResponse;

        // Check for cache existence
        getCache('boards_' + username, true, function (cacheData) {
            if (cacheData === null) {
                // Create get request and put it in the cache
                get('http://pinterestapi.co.uk/' + username + '/boards', true, function (response) {
                    putCache('boards_' + username, JSON.stringify(response));

                    if (paginate) {
                        boardsResponse = buildResponse(response.body ? response.body : []);
                    } else {
                        boardsResponse = response.body ? response.body : [];
                    }
                    callback(boardsResponse);
                    return;
                });
            } else {
                if (paginate) {
                    boardsResponse = buildResponse(cacheData.body ? cacheData.body : []);
                } else {
                    boardsResponse = cacheData.body ? cacheData.body : [];
                }
                callback(boardsResponse);
                return;
            }
        });
    }

    /*
     * Get pins from a single board
     *
     * @param string board
     * @param boolean paginate
     * @param Function callback
     * @invoke callback(Mixed pins)
     */

    function getPinsFromBoard(board, paginate, callback) {
        var pins = [];
        var pinDateMap = {};

        async.parallel([
            function (asyncCallback) {
                getCache(board, true, function (cacheData) {
                    if (cacheData === null) {
                        // Get data and put it in the cache
                        get('https://api.pinterest.com/v3/pidgets/boards/' + username + '/' + board.replace(/#/g, '') + '/pins/', true, function (response) {
                            putCache(board, JSON.stringify(response));
                            pins = response.data ? response.data.pins : [];
                            asyncCallback();
                        });
                    } else {
                        pins = cacheData.data ? cacheData.data.pins : [];
                        asyncCallback();
                    }
                });
            },
            function (asyncCallback) {
                if (!obtainDates) {
                    asyncCallback();
                    return;
                }

                getDatesForBoardPinsFromRss(username, board, function (dates) {
                    pinDateMap = dates;
                    asyncCallback();
                    return;
                });
            }],
            function (err) {
                if (err) { throw err; }
                var pinIdsThatNeedDates = [];
                for (var i = 0; i < pins.length; i++) {
                    pins[i].created_at = null;
                    pins[i].created_at_source = null;
                    if (pinDateMap[pins[i].id]) {
                        pins[i].created_at = pinDateMap[pins[i].id];
                        pins[i].created_at_source = 'rss';
                    } else {
                        pinIdsThatNeedDates.push(pins[i].id);
                    }
                }

                if (obtainDates) {
                    getDatesForPinsFromScraping(pinIdsThatNeedDates, null, function (scrapedPinDateMap) {
                        for (var i = 0; i < pins.length; i++) {
                            if (scrapedPinDateMap[pins[i].id] && scrapedPinDateMap[pins[i].id].date) {
                                pins[i].created_at = scrapedPinDateMap[pins[i].id].date;
                                pins[i].created_at_source = scrapedPinDateMap[pins[i].id].source;
                            }
                        }
                        if (paginate) {
                            pins = buildResponse(pins);
                        }

                        callback(pins);
                        return;
                    });
                } else {
                    if (paginate) {
                        pins = buildResponse(pins);
                    }

                    callback(pins);
                    return;
                }
            }
        );
    }

    /*
     * Get all the user's pins (from all boards we can get)
     *
     * @param Function callback
     * @invoke callback(Object pins)
     */

    function getPins(callback) {
        var allPins = [];
        getBoards(false, function (boards) {
            async.each(boards, function(board, asyncCallback) {
                var splitHref = board.href.split('/');
                if (splitHref[1] === username) { // it's possible to have boards listed from other users
                    var boardHref = board.href.split('/')[2];
                    getPinsFromBoard(boardHref, false, function (pins) {
                        allPins = allPins.concat(pins);
                        asyncCallback();
                    });
                } else {
                    asyncCallback();
                }
            },
            function (err) {
                if (err) {
                    console.error('Error iterating through each board to get pins');
                    throw err;
                }
                callback(buildResponse(allPins));
                return;
            });
        });
    }

    /*
     * Get obtainDates variable
     *
     */

    function getObtainDates() {
        return obtainDates;
    }

    /*
     * Set obtainDates variable
     *
     * @param boolean bool
     */

    function setObtainDates(bool) {
        obtainDates = bool;
    }

    return {
        getPins: getPins,
        getBoards: getBoards,
        getPinsFromBoard: getPinsFromBoard,
        getCurrentPage: getCurrentPage,
        setCurrentPage: setCurrentPage,
        getItemsPerPage: getItemsPerPage,
        setItemsPerPage: setItemsPerPage,
        getObtainDates: getObtainDates,
        setObtainDates: setObtainDates
    };
}
702070
function ResponseApi(constructorOptions) {

    LOG.debug('Instantiating new response object');
    LOG.debug('Validating options');

    try {

        this.options =
            new responseOptions.Constructor().validate(constructorOptions);

    } catch (err) {

        LOG.error('Received error: %s', err);

        throw(err);

    }

    this.response = {};
    this.isBatch = false;

    this._createResponseView();

}
101898
function init(options) {
  options = options || {}
  var port = options.port || 6466
  global.client = global.client || socketIOClient(`http://localhost:${port}`)
  client = global.client
  log.debug(`Started global js socketIO client for ${process.env.ADAPTER} at ${port}`)
  client.emit('join', ioid) // first join for serialization
  client.on('disconnect', client.disconnect)
  client.on('take', hasher.handle) // add listener
  
  // add methods
  client.pass = pass
  client.clientPass = clientPass
  return client
}
459299
function init(options = {}, handlebars) {
  const opts = deepExtend({}, defaults, options);
  normalizePaths(opts);
  opts.handlebars = handlebars || Handlebars.create();
  return Promise.resolve(opts);
}
1088624
function(options){
    this.triggerMethod("initialize:before", options);
    this._initCallbacks.run(options, this);
    this.triggerMethod("initialize:after", options);

    this.triggerMethod("start", options);
  }
711611
function createOptions( options ) {
    var object = optionsCache[ options ] = {};
    _each( options.split( /\s+/ ), function( flag ) {
      object[ flag ] = true;
    });
    return object;
  }
1346502
function WaitScreen(options) {
        options = options || {};

        /**
         * ### WaitScreen.id
         *
         * The id of _waitingDiv_. Default: 'ng_waitScreen'
         *
         * @see WaitScreen.waitingDiv
         */
        this.id = options.id || 'ng_waitScreen';

        /**
         * ### WaitScreen.root
         *
         * Reference to the root element under which _waitingDiv is appended
         *
         * @see WaitScreen.waitingDiv
         */
        this.root = options.root || null;

        /**
         * ### WaitScreen.waitingDiv
         *
         * Reference to the HTML Element that actually locks the screen
         */
        this.waitingDiv = null;

        /**
         * ### WaitScreen.beforePauseText
         *
         * Flag if the screen should stay locked after a RESUMED event
         *
         * Contains the value of the innerHTML attribute of the waiting div.
         */
        this.beforePauseInnerHTML = null;

        /**
         * ### WaitScreen.enabled
         *
         * Flag is TRUE if the listeners are registered
         *
         * @see WaitScreen.enable
         */
        this.enabled = false;

        /**
         * ### WaitScreen.contentDiv
         *
         * Div containing the main content of the wait screen
         */
        this.contentDiv = null;

        /**
         * ### WaitScreen.countdownDiv
         *
         * Div containing the countdown span and other text
         *
         * @see WaitScreen.countdown
         * @see WaitScreen.countdownSpan
         */
        this.countdownDiv = null;

        /**
         * ### WaitScreen.countdownSpan
         *
         * Span containing a countdown timer for the max waiting
         *
         * @see WaitScreen.countdown
         * @see WaitScreen.countdownDiv
         */
        this.countdownSpan = null;

        /**
         * ### WaitScreen.countdown
         *
         * Countdown of max waiting time
         *
         * @see WaitScreen.countdown
         */
        this.countdown = null;

        /**
         * ### WaitScreen.text
         *
         * Default texts for default events
         */
        this.defaultTexts = {
            waiting: options.waitingText ||
                'Waiting for other players to be done...',
            stepping: options.steppingText ||
                'Initializing game step, will be ready soon...',
            paused: options.pausedText ||
                'Game is paused. Please wait.'
        };

        /**
         * ## WaitScreen.lockedInputs
         *
         * List of locked inputs by the _lock_ method
         *
         * @see WaitScreen.lock
         */
        this.lockedInputs = [];

        // Registers the event listeners.
        this.enable();
    }
1083021
function init (optionPresets = {}, optionFormats = {}) {
  Object.keys(optionPresets).forEach((key) => preset(key, optionPresets[key]))
  Object.keys(optionFormats).forEach((key) => assign(key, optionFormats[key]))
}