Просмотр исходного кода

Add missing localStorage.coffee... oops

James Allen 11 лет назад
Родитель
Сommit
18d627baba
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      services/web/public/coffee/modules/localStorage.coffee

+ 12 - 0
services/web/public/coffee/modules/localStorage.coffee

@@ -0,0 +1,12 @@
+angular.module("localStorage", [])
+	.value "localStorage", (args...) ->
+		###
+		localStorage can throw browser exceptions, for example if it is full
+		We don't use localStorage for anything critical, on in that case just
+		fail gracefully.
+		###
+		try
+			return $.localStorage args...
+		catch e
+			console.error "localStorage exception", e
+			return null