dojo 官方翻译 dojo/aspect
官网地址:http://dojotoolkit.org/reference-guide/1.10/dojo/aspect.html
after()
定义:after(target, methodName, advisingFunction, receiveArguments);
意义:在target的methodName方法之后执行advisingFunction方法。
define(["dojo/aspect"], function(aspect){
aspect.after(dojo, "xhr", function(deferred){
// this is called after any dojo.xhr call
});
// this will execute the original dojo.xhr method and then our advising function
dojo.xhr("GET", {...});
});
dojo.require("dojo.aspect");
dojo.aspect.after(dojo, "xhr", function(response){
...
});
before()
定义:before(target, methodName, advisingFunction);
意义:在target的methodName方法之前执行adviseingFunction。
define(["dojo/aspect"], function(aspect){
aspect.before(dojo, "xhr", function(method, args){
// this is called before any dojo.xhr call
if(method == "PUT"){
// if the method is PUT, change it to a POST and put the method in the parameter string
args.url += "?x-method=PUT";
// return the new args
return ["POST", args];
}
});
// this will execute the original our advising function and then dojo.xhr
dojo.xhr("PUT", {...});
});
around()
定义:around(target, methodName, advisingFactory);
define(["dojo/aspect"], function(aspect){
aspect.around(dojo, "xhr", function(originalXhr){
return function(method, args){
// doing something before the original call
var deferred = originalXhr(method, args);
// doing something after the original call
return deferred;
}
});
dojo.xhr("PUT", {...});
});
dojo 官方翻译 dojo/aspect的更多相关文章
- dojo 官方翻译 dojo/_base/lang 版本1.10
官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/_base/lang.html#dojo-base-lang 应用加载声明: require ...
- dojo 官方翻译 dojo/_base/array 版本1.10
官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/_base/array.html#dojo-base-array array模块dojo进行 ...
- dojo 官方翻译 dojo/domReady 版本1.10
官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/domReady.html#dojo-domready dom加载完成后,执行. requi ...
- dojo 官方翻译 dojo/json 版本1.10
官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/json.html#dojo-json require(["dojo/json&q ...
- dojo 官方翻译 dojo/string 版本1.10
官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/string.html#dojo-string require(["dojo/st ...
- dojo 官方翻译 dojo/Deferred
延迟,异步调用 官网地址:http://dojotoolkit.org/reference-guide/1.9/dojo/Deferred.html require(["dojo/Defer ...
- DOJO官方API翻译或解读-dojo/store (自定制存储器)
dojo/store 是对已存数据的访问和存储的统一接口,dojo/store意图以一个简单.易于使用和扩展的API来,替代.集合和改善 dojo/data 和dojox/storage .基于HTM ...
- Events with Dojo(翻译)
In this tutorial, we will be exploring dojo/on and how Dojo makes it easy to connect to DOM events. ...
- 现代DOJO(翻译)
http://dojotoolkit.org/documentation/tutorials/1.10/modern_dojo/index.html 你可能已经不用doio一段时间了,或者你一直想保持 ...
随机推荐
- Grodno 2015 (Urozero May 2015 Day 5) D Triangles
给出$P(<=10^9)$, 求有多少个有序三元组$(a, b, c),\ gcd(a, b, c) = 1,\ a + b + c <= P$且以它们构成的三角形中存在某个角是另外一个角 ...
- 【BZOJ】2018: [Usaco2009 Nov]农场技艺大赛(暴力)
http://www.lydsy.com/JudgeOnline/problem.php?id=2018 精度问题我也是醉了.. #include <cstdio> #include &l ...
- asp.net网站防恶意刷新的Cookies与Session解决方法
本文实例讲述了asp.net网站防恶意刷新的Cookies与Session解决方法,是WEB程序设计中非常实用的技巧.分享给大家供大家参考.具体实现方法如下: Session版实现方法: public ...
- boost数据结构tuple
boost数据结构tuple tuple(元组)定义了一个有固定数目元素的容器,其中每个元素类型可以不相同,这与其它容器有着本质的区别!vector和array虽然可以容纳很多元素,但是元素的类型必须 ...
- 根据百度地图API得到坐标和地址并在地图上显示
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout ...
- Java Base64解析
最近在业务场景中,需要对第三方传递进来的字符进行base64解密,根据第三方文档提供的解析工具,对数据进行了解析,关于Base64的解析方式如下: String sign = "xxxxxx ...
- A day
今天推荐一部微电影,从老人的视角看这个社会. 老人在途中买橘子的经历仿佛是看到了当年自己的影子. A day对于有些人来说,很长.对于某些人来说很短暂.这一天所做的事情就是穿过马路走过天桥去水果店买四 ...
- cross-origin HTTP request
w https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS A resource makes a cross-ori ...
- 容灾 RPO RTO
w https://en.wikipedia.org/wiki/Recovery_point_objective A recovery point objective, or “RPO”, is de ...
- wcf 开发 1
1.创建wcf应用程序 2.生成服务,启动 3.使用工具生成 文件如下: 4.新增加winform程序项目,并添加文件 service1.cs 修改app.config 5.代码调用 private ...