{"size": 2041, "ext": "es6", "max_stars_repo_path": "theme/scripts/index.es6", "max_stars_repo_name": "DNepovim/kraj-praha", "max_stars_repo_stars_event_min_datetime": "2017-03-15T22:35:14.000Z", "max_stars_repo_stars_event_max_datetime": "2017-03-27T09:58:05.000Z", "max_issues_repo_path": "theme/scripts/index.es6", "max_issues_repo_name": "DNepovim/kraj-praha", "max_issues_repo_issues_event_min_datetime": "2016-08-29T08:02:28.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-29T11:34:08.000Z", "max_forks_repo_path": "theme/scripts/index.es6", "max_forks_repo_name": "DNepovim/kraj-praha", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 132, "max_forks_count": null, "avg_line_length": 29.5797101449, "max_line_length": 129, "alphanum_fraction": 0.7016168545}
//
// Main project bundle
//

// Dependencies
//
require('./plugins')


if(DEBUG) console.log('Initializing components...')
if(DEBUG) console.time('Components initialization')

//
// Lazy components initialization from initComponents queue
//
// Components declarations
var components = {
	'colorswitcher': require('./components/colorswitcher'),
	'imageupload': require('./components/imageupload'),
	'logoswitcher': require('./components/logoswitcher'),
	'scrollToAnchor': require('./components/scrollToAnchor'),
	'shapes': require('./components/shapes')
}
var instances = []

// Init function
var init = (component) => {
	if(component.name in components){
		if(DEBUG) console.time('\tcomponent: ' + component.name)

		var Component = components[component.name] // class
		var placement = (typeof component.place == 'string') ? document.querySelector(component.place) : component.place // DOM element
		var instance = new Component(placement, component.data || {}) // new instance

		instances.push(instance)

		if(DEBUG) console.timeEnd('\tcomponent: ' + component.name)
	} else {
		if(DEBUG) console.warn('Component with name ' + component.name + ' was not found!')
	}
}
// Instance only required components
initComponents.map(init)

// Allow lazy init of components after page load
initComponents = {
	push: init
}

if(DEBUG) console.timeEnd('Components initialization')
if(DEBUG) console.log('Instances', instances)

//
// Print timing data on page load
//
if(DEBUG) {
	function printPerfStats() {
		var timing = window.performance.timing
		console.log('Performance:\n' +
			'\tdns: \t\t' + (timing.domainLookupEnd - timing.domainLookupStart) + 'ms\n' +
			'\tconnect: \t' + (timing.connectEnd - timing.connectStart) + 'ms\n' +
			'\tttfb: \t\t' + (timing.responseStart - timing.connectEnd) + 'ms\n' +
			'\tbasePage: \t' + (timing.responseEnd - timing.responseStart) + 'ms\n' +
			'\tfrontEnd: \t' + (timing.loadEventStart - timing.responseEnd) + 'ms\n'
		)
	}
	window.addEventListener('load', () => setTimeout(printPerfStats, 1000))
}
