<commit_before>/**
 * Main class for handling data and rendering logic for a route.
 *
 * @constructor RouteController
 * @param {RouteContext} context
 * @param {Object} [options]
 * @param {String|Function} [options.template]
 * @param {String|Function} [options.loadingTemplate]
 * @param {String|Function} [options.notFoundTemplate]
 * @param {Object|Function} [options.data]
 */

//@export RouteController
RouteController = function (context, options) {
  var routerOptions
    , routeOptions;

  context = context || {};
  options = this.options = options || {};

  routerOptions = (context.router && context.router.options) || {};
  routeOptions = (context.route && context.route.options) || {};

  this.params = context.params || [];
  this.route = context.route;
  this.router = context.router;
  this.context = context;

  this.loadingTemplate = options.loadingTemplate 
    || routeOptions.loadingTemplate 
    || routerOptions.loadingTemplate 
    || this.loadingTemplate;

  this.notFoundTemplate = options.notFoundTemplate 
    || routeOptions.notFoundTemplate
    || routerOptions.notFoundTemplate
    || this.notFoundTemplate;

  this.data = options.data 
    || routeOptions.data
    || routerOptions.data
    || this.data;

  this.onBeforeRun = options.onBeforeRun
    || routeOptions.onBeforeRun
    || routerOptions.onBeforeRun
    || this.onBeforeRun;

  this.onAfterRun = options.onAfterRun
    || routeOptions.onAfterRun
    || routerOptions.onAfterRun
    || this.onAfterRun;

  this.onBeforeRerun = options.onBeforeRerun
    || routeOptions.onBeforeRerun
    || routerOptions.onBeforeRerun
    || this.onBeforeRerun;

  this.onAfterRerun = options.onAfterRerun
    || routeOptions.onAfterRerun
    || routerOptions.onAfterRerun
    || this.onAfterRerun;

  this.template = options.template
    || routeOptions.template
    || routerOptions.template
    || this.template
    || (this.route && this.route.name);

  this.renderTemplates = options.renderTemplates
    || routeOptions.renderTemplates
    || routerOptions.renderTemplates
    || this.renderTemplates;

  this.stopped = false;

  this.before = []
    .concat(RouterUtils.toArray(routerOptions.before))
    .concat(RouterUtils.toArray(routeOptions.before))<commit_msg>Allow wait on to be set on the router or route.<commit_after>/**
 * Main class for handling data and rendering logic for a route.
 *
 * @constructor RouteController
 * @param {RouteContext} context
 * @param {Object} [options]
 * @param {String|Function} [options.template]
 * @param {String|Function} [options.loadingTemplate]
 * @param {String|Function} [options.notFoundTemplate]
 * @param {Object|Function} [options.data]
 */

//@export RouteController
RouteController = function (context, options) {
  var routerOptions
    , routeOptions;

  context = context || {};
  options = this.options = options || {};

  routerOptions = (context.router && context.router.options) || {};
  routeOptions = (context.route && context.route.options) || {};

  this.params = context.params || [];
  this.route = context.route;
  this.router = context.router;
  this.context = context;

  this.loadingTemplate = options.loadingTemplate 
    || routeOptions.loadingTemplate 
    || routerOptions.loadingTemplate 
    || this.loadingTemplate;

  this.notFoundTemplate = options.notFoundTemplate 
    || routeOptions.notFoundTemplate
    || routerOptions.notFoundTemplate
    || this.notFoundTemplate;

  this.data = options.data 
    || routeOptions.data
    || routerOptions.data
    || this.data;

  this.onBeforeRun = options.onBeforeRun
    || routeOptions.onBeforeRun
    || routerOptions.onBeforeRun
    || this.onBeforeRun;

  this.onAfterRun = options.onAfterRun
    || routeOptions.onAfterRun
    || routerOptions.onAfterRun
    || this.onAfterRun;

  this.onBeforeRerun = options.onBeforeRerun
    || routeOptions.onBeforeRerun
    || routerOptions.onBeforeRerun
    || this.onBeforeRerun;

  this.onAfterRerun = options.onAfterRerun
    || routeOptions.onAfterRerun
    || routerOptions.onAfterRerun
    || this.onAfterRerun;

  this.template = options.template
    || routeOptions.template
    || routerOptions.template
    || this.template
    || (this.route && this.route.name);

  this.renderTemplates = options.renderTemplates
    || routeOptions.renderTemplates
    || routerOptions.renderTemplates
    || this.renderTemplates;
  
  this.waitOn = options.waitOn
    || routeOptions.waitOn
    || routerOptions.waitOn
    || this.waitOn;

  this.stopped = false;

  this.before = []
    .concat(RouterUtils.toArray(routerOptions.before))
    .concat(RouterUtils.toArray(routeOptions.before))
{'fraction_non_alphanumeric': 0.11964708414030557, 'fraction_numerical': 0.0, 'mean_word_length': 3.836628511966701, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2205340', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1345, 'n_words': 238}