4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-data-proxy-SessionStorage'>/**
19 </span> * @author Ed Spencer
20 * @class Ext.data.proxy.SessionStorage
21 * @extends Ext.data.proxy.WebStorage
23 * <p>Proxy which uses HTML5 session storage as its data storage/retrieval mechanism.
24 * If this proxy is used in a browser where session storage is not supported, the constructor will throw an error.
25 * A session storage proxy requires a unique ID which is used as a key in which all record data are stored in the
26 * session storage object.</p>
28 * <p>It's important to supply this unique ID as it cannot be reliably determined otherwise. If no id is provided
29 * but the attached store has a storeId, the storeId will be used. If neither option is presented the proxy will
30 * throw an error.</p>
32 * <p>Proxies are almost always used with a {@link Ext.data.Store store}:<p>
34 <pre><code>
37 type: 'sessionstorage',
41 </code></pre>
43 * <p>Alternatively you can instantiate the Proxy directly:</p>
45 <pre><code>
46 new Ext.data.proxy.SessionStorage({
47 id : 'myOtherProxyKey'
49 </code></pre>
51 * <p>Note that session storage is different to local storage (see {@link Ext.data.proxy.LocalStorage}) - if a browser
52 * session is ended (e.g. by closing the browser) then all data in a SessionStorageProxy are lost. Browser restarts
53 * don't affect the {@link Ext.data.proxy.LocalStorage} - the data are preserved.</p>
55 Ext.define('Ext.data.proxy.SessionStorage', {
56 extend: 'Ext.data.proxy.WebStorage',
57 alias: 'proxy.sessionstorage',
58 alternateClassName: 'Ext.data.SessionStorageProxy',
61 getStorageObject: function() {
62 return window.sessionStorage;