Debian Codegraph @

closure-library/closure/goog/storage/mechanism/html5localstorage.js

raw
1 // Copyright 2011 The Closure Library Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS-IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 /**
16 * @fileoverview Provides data persistence using HTML5 local storage
17 * mechanism. Local storage must be available under window.localStorage,
18 * see: http://www.w3.org/TR/webstorage/#the-localstorage-attribute.
19 *
20 */
21
22 goog.provide('goog.storage.mechanism.HTML5LocalStorage');
23
24 goog.require('goog.storage.mechanism.HTML5WebStorage');
25
26
27
28 /**
29 * Provides a storage mechanism that uses HTML5 local storage.
30 *
31 * @constructor
32 * @struct
33 * @extends {goog.storage.mechanism.HTML5WebStorage}
34 */
35 goog.storage.mechanism.HTML5LocalStorage = function() {
36 var storage = null;
37
38 try {
39 // May throw an exception in cases where the local storage object
40 // is visible but access to it is disabled.
41 storage = window.localStorage || null;
42 } catch (e) {
43 }
44 goog.storage.mechanism.HTML5LocalStorage.base(this, 'constructor', storage);
45 };
46 goog.inherits(
47 goog.storage.mechanism.HTML5LocalStorage,
48 goog.storage.mechanism.HTML5WebStorage);