非常好的sencha touch入门资料
Using Proxies
翻译者:郭玉潮
(为了方便书写,本文中约定sencha touch 2简写为ST2。)
要是想了解Proxy,其实解释并不是很难,简单的说就是代理,那么代理又是什么呢,我们先来好好的研究一下ST2中的MVC吧,我们这里并不想详细讲解MVC,在ST2中,我们的数据模型定义在Model中,那么这些数据的实体呢,就在Store中,Store就是利用Proxy来操作数据的加载和保存的(MVC请见ST2中的详细讲解)。
在ST2中,Proxy只要有两大类:client和server。好,那么我们就先看看client类的Proxy:
Ext.data.proxy.LocalStorageproxy: localstorage
该代理,使用了HTML5最新的特性,使用了localStorage API将Model的数据直接存储在客户端的浏览器中。这些数据只能是简单的键值对的,不能存储复杂的数据的,像JSON就不行的。在我们保存或者检索数据的时候,LocalStorageProxy将自动的组串或者解串。
localStorage在保存用户的一些特殊信息方面还是极其有用的,因为这并不需要服务器来添加其他的设置来支持这些的。假如我们正在写一个Twitter搜索的应用程序,并把这些搜索的信息存储在本地,以便稍后检索。我们就可以创建一个Search的model:

Using Components in senchaTouch2_IT/计算机_专业资料。选填,简要介绍文档的... Using Proxy in senchaT... 15页 免费 Using Froms in senchaT... 暂无...
Using Froms in senchaTouch2_IT/计算机_专业资料。选填,简要介绍文档的主要... Using Proxy in senchaT... 15页 免费 using L-moments in 暂无评价 14页...
Integration WebLogic 9.2 with OAM 10.1.4.3(using Proxy)_IT/计算机_专业资料。Oracle Access Manager与WebLogic集成,使用Proxy...
五、 代理模式示例性代码以下示例性代码实现了代理模式: // Proxy pattern -- Structural example using System; // "Subject" abstract class Subject { // ...
比如要列出给定用户每个帖子中的全部评论,我们可以这样做: // Loads User with ID 1 and related posts and comments using User's Proxy // 使用 User 的...
All subsequent communications between the client and the remote secure server are encrypted using that key and sent to the proxy server which then acts ...
{ interceptor});//实例化 return proxy as T; } } } 最后我们测试一下 代码 using using using using System; System.Collections.Generic; System.Linq; ...
热门文档