{"size": 683, "ext": "js", "max_stars_repo_path": "assets/fabricDirtyStatus.js", "max_stars_repo_name": "troylelandshields/angular-fabric-lite", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "assets/fabricDirtyStatus.js", "max_issues_repo_name": "troylelandshields/angular-fabric-lite", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "assets/fabricDirtyStatus.js", "max_forks_repo_name": "troylelandshields/angular-fabric-lite", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18.9722222222, "max_line_length": 102, "alphanum_fraction": 0.6734992679}
angular.module('common.fabric-lite.dirtyStatus', [])

.service('FabricDirtyStatus', ['$window', function($window) {

	var self = {
		dirty: false
	};

	function checkSaveStatus() {
		if (self.isDirty()) {
			return "Oops! You have unsaved changes.\n\nPlease save before leaving so you don't lose any work.";
		}
	}

	self.endListening = function() {
		$window.onbeforeunload = null;
		$window.onhashchange = null;
	};

	self.startListening = function() {
		$window.onbeforeunload = checkSaveStatus;
		$window.onhashchange = checkSaveStatus;
	};

	self.isDirty = function() {
		return self.dirty;
	};

	self.setDirty = function(value) {
		self.dirty = value;
	};

	return self;

}]);
