<commit_before>/**
* Creates a new window
* @constructor
* @param {object} json - json fron app.json
* @param {array} windows - array of windows
* @param {array} order - array for order of windows
*/
var Win = function(json, windows, order){
  if(typeof json !== "object"){
    throw new Error('Win constructor needs a json object');
  }
  // throw error if multiple windows is false and there already is a window
  if(json.multipleWindows === false){
    for(var i = 0; i < windows.length; ++i){
      if(windows[i] && windows[i].name === json.name){
        throw new Error('multipleWindows: false and there already is a window');
      }
    }
  }
  /**
  * Order of windows
  * @type {array}
  */
  this._order = order;
  this.json = json;
  this.name = json.name;
  this.url = json.url;
  this.icon = json.icon;
  this.title = json.title;
  this.running = false;
  this.minimized = true;
  this.active = false;
  // position
  this.x = 0;
  this.y = 0;
  this.z = 0;
  // in percentages
  this.width = 100;
  this.height = 100;
  
}

Win.prototype.open = function(){
  this.minimized = false;
  this._order.unshift(this.index);
  updateOrder();
}
Win.prototype.start = function () {
  windows.push(this);
  this.index = windows.length - 1;
  this.running = true;
}
Win.prototype.minimize = function () {
  this.minimized = true;
  var position = this._order.indexOf(this.index);
  this._order.splice(position, 1);
  updateOrder();
}
Win.prototype.close = function () {
  this.minimized = true;
  this.running = false;
  var position = this._order.indexOf(this.index);
  this._order.splice(position, 1);
  windows[this.index] = undefined;
  updateOrder();
}<commit_msg>Windows completely hide when closed<commit_after>/**
* Creates a new window
* @constructor
* @param {object} json - json fron app.json
* @param {array} windows - array of windows
* @param {array} order - array for order of windows
*/
var Win = function(json, windows, order){
  if(typeof json !== "object"){
    throw new Error('Win constructor needs a json object');
  }
  // throw error if multiple windows is false and there already is a window
  if(json.multipleWindows === false){
    for(var i = 0; i < windows.length; ++i){
      if(windows[i] && windows[i].name === json.name){
        throw new Error('multipleWindows: false and there already is a window');
      }
    }
  }
  /**
  * Order of windows
  * @type {array}
  */
  this._order = order;
  this.json = json;
  this.name = json.name;
  this.url = json.url;
  this.icon = json.icon;
  this.title = json.title;
  this.running = false;
  this.minimized = true;
  this.active = false;
  // position
  this.x = 0;
  this.y = 0;
  this.z = 0;
  // in percentages
  this.width = 100;
  this.height = 100;
  
}

Win.prototype.open = function(){
  this.minimized = false;
  this._order.unshift(this.index);
  updateOrder();
}
Win.prototype.start = function () {
  windows.push(this);
  this.index = windows.length - 1;
  this.running = true;
}
Win.prototype.minimize = function () {
  this.minimized = true;
  var position = this._order.indexOf(this.index);
  this._order.splice(position, 1);
  updateOrder();
}
Win.prototype.close = function () {
  this.minimized = true;
  this.running = false;
  var position = this._order.indexOf(this.index);
  this._order.splice(position, 1);
  var placeholder = {
    minimized: true,
    running: false
  };
  windows[this.index] = placeholder;
  updateOrder();
}
{'fraction_non_alphanumeric': 0.14634855979051498, 'fraction_numerical': 0.007564736688972942, 'mean_word_length': 3.162227602905569, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4720404', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1135, 'n_words': 310}