| 1 | /* |
| 2 | * Copyright 2009 Closure Compiler Authors |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | /** |
| 17 | * @fileoverview Definitions for W3C's WebStorage specification. |
| 18 | * This file depends on html5.js. |
| 19 | * @externs |
| 20 | */ |
| 21 | |
| 22 | /** |
| 23 | * @interface |
| 24 | * @see http://www.w3.org/TR/2011/CR-webstorage-20111208/#the-storage-interface |
| 25 | */ |
| 26 | function Storage() {} |
| 27 | |
| 28 | /** |
| 29 | * @type {number} |
| 30 | * @const |
| 31 | */ |
| 32 | Storage.prototype.length; |
| 33 | |
| 34 | /** |
| 35 | * @param {number} index |
| 36 | * @return {?string} |
| 37 | */ |
| 38 | Storage.prototype.key = function(index) {}; |
| 39 | |
| 40 | /** |
| 41 | * @param {string} key |
| 42 | * @return {?string} |
| 43 | */ |
| 44 | Storage.prototype.getItem = function(key) {}; |
| 45 | |
| 46 | /** |
| 47 | * @param {string} key |
| 48 | * @param {string} data |
| 49 | * @return {void} |
| 50 | */ |
| 51 | Storage.prototype.setItem = function(key, data) {}; |
| 52 | |
| 53 | /** |
| 54 | * @param {string} key |
| 55 | * @return {void} |
| 56 | */ |
| 57 | Storage.prototype.removeItem = function(key) {}; |
| 58 | |
| 59 | /** |
| 60 | * @return {void} |
| 61 | */ |
| 62 | Storage.prototype.clear = function() {}; |
| 63 | |
| 64 | /** |
| 65 | * @interface |
| 66 | * @see http://www.w3.org/TR/2011/CR-webstorage-20111208/#the-sessionstorage-attribute |
| 67 | */ |
| 68 | function WindowSessionStorage() {} |
| 69 | |
| 70 | /** |
| 71 | * @type {Storage} |
| 72 | */ |
| 73 | WindowSessionStorage.prototype.sessionStorage; |
| 74 | |
| 75 | /** |
| 76 | * Window implements WindowSessionStorage |
| 77 | * |
| 78 | * @type {Storage} |
| 79 | */ |
| 80 | Window.prototype.sessionStorage; |
| 81 | |
| 82 | /** |
| 83 | * @interface |
| 84 | * @see http://www.w3.org/TR/2011/CR-webstorage-20111208/#the-localstorage-attribute |
| 85 | */ |
| 86 | function WindowLocalStorage() {} |
| 87 | |
| 88 | /** |
| 89 | * @type {Storage} |
| 90 | */ |
| 91 | WindowLocalStorage.prototype.localStorage; |
| 92 | |
| 93 | /** |
| 94 | * Window implements WindowLocalStorage |
| 95 | * |
| 96 | * @type {Storage} |
| 97 | */ |
| 98 | Window.prototype.localStorage; |
| 99 | |
| 100 | /** |
| 101 | * This is the storage event interface. |
| 102 | * @see http://www.w3.org/TR/2011/CR-webstorage-20111208/#the-storage-event |
| 103 | * @extends {Event} |
| 104 | * @constructor |
| 105 | */ |
| 106 | function StorageEvent() {} |
| 107 | |
| 108 | /** |
| 109 | * @type {string} |
| 110 | */ |
| 111 | StorageEvent.prototype.key; |
| 112 | |
| 113 | /** |
| 114 | * @type {?string} |
| 115 | */ |
| 116 | StorageEvent.prototype.oldValue; |
| 117 | |
| 118 | /** |
| 119 | * @type {?string} |
| 120 | */ |
| 121 | StorageEvent.prototype.newValue; |
| 122 | |
| 123 | /** |
| 124 | * @type {string} |
| 125 | */ |
| 126 | StorageEvent.prototype.url; |
| 127 | |
| 128 | /** |
| 129 | * @type {?Storage} |
| 130 | */ |
| 131 | StorageEvent.prototype.storageArea; |
| 132 | |
| 133 | /** |
| 134 | * @param {string} typeArg |
| 135 | * @param {boolean} canBubbleArg |
| 136 | * @param {boolean} cancelableArg |
| 137 | * @param {string} keyArg |
| 138 | * @param {?string} oldValueArg |
| 139 | * @param {?string} newValueArg |
| 140 | * @param {string} urlArg |
| 141 | * @param {?Storage} storageAreaArg |
| 142 | * @return {void} |
| 143 | */ |
| 144 | StorageEvent.prototype.initStorageEvent = function(typeArg, canBubbleArg, |
| 145 | cancelableArg, keyArg, |
| 146 | oldValueArg, newValueArg, |
| 147 | urlArg, storageAreaArg) {}; |
| 148 |