4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/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
21 * Proxy which uses HTML5 session storage as its data storage/retrieval mechanism. If this proxy is used in a browser
22 * where session storage is not supported, the constructor will throw an error. A session storage proxy requires a
23 * unique ID which is used as a key in which all record data are stored in the session storage object.
25 * It's important to supply this unique ID as it cannot be reliably determined otherwise. If no id is provided but the
26 * attached store has a storeId, the storeId will be used. If neither option is presented the proxy will throw an error.
28 * Proxies are almost always used with a {@link Ext.data.Store store}:
30 * new Ext.data.Store({
32 * type: 'sessionstorage',
37 * Alternatively you can instantiate the Proxy directly:
39 * new Ext.data.proxy.SessionStorage({
40 * id : 'myOtherProxyKey'
43 * Note that session storage is different to local storage (see {@link Ext.data.proxy.LocalStorage}) - if a browser
44 * session is ended (e.g. by closing the browser) then all data in a SessionStorageProxy are lost. Browser restarts
45 * don't affect the {@link Ext.data.proxy.LocalStorage} - the data are preserved.
47 Ext.define('Ext.data.proxy.SessionStorage', {
48 extend: 'Ext.data.proxy.WebStorage',
49 alias: 'proxy.sessionstorage',
50 alternateClassName: 'Ext.data.SessionStorageProxy',
53 getStorageObject: function() {
54 return window.sessionStorage;