 webkitNotifications = window.webkitNotifications or {}
 class window.NotificationCenter
 	constructor: () ->
-		@denied = false;
-		@hasPermission = false;
+		@denied = false
+		@hasPermission = false
+		@regex = null
+		@enabled = false
 		if window.localStorage.getItem 'notifications-enabled'
+			@enabled = true
 			@getPermission()
 			# Just in case we're using an older ver of the speck, ask on the first click as well.
 			clickus = () =>
 				document.removeEventListener 'click', clickus
 				@getPermission()
 			document.addEventListener 'click', clickus
+			# Load the stored notification regex
+			if regex = window.localStorage.getItem 'notifications-regex'
+				try @regex = new RegExp regex, 'gim'
 
-	getPermission: (cback = null) ->
+
+	getPermission: () ->
 		if @hasPermission or Notification.permission == 'granted' or webkitNotifications.checkPermission?() == 0
 			@hasPermission = true
-			cback?()
 		else if @denied or Notification.permission == 'denied' or webkitNotifications.checkPermission?() == 2
 			@denied = true
 		else

	enableNotifications: () ->
		@getPermission();
		window.localStorage.setItem 'notifications-enabled', true


				Notification.requestPermission (permission) =>
					if permission == 'granted'
						@hasPermission = true
					else
						@denied = true
			else
				webkitNotifications.requestPermission () =>
					if webkitNotifications.checkPermission() == 0
						@hasPermission = true
					else
						@denied = true

