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一段时间了,或者你一直想保持 ...
随机推荐
- Apollo 刨析:Localization
九月 30 2014 11:27 上午 admin 0 Comments 今天我们来看一看Apollo中的Localization Component. 本地化在Apollo中的使用 像这样的 ...
- Linux下面 多线程死锁问题的调试
最近写服务,经常是单进程,多线程的,加了各种锁,很担心出现死锁问题,专门学习了一下死锁问题的诊断. 死锁 (deallocks): 是指两个或两个以上的进程(线程)在执行过程中,因争夺资源而造成的一种 ...
- Yii2 选择布局的方式
方案1:控制器内成员变量 public $layout = false; //不使用布局 public $layout = "main"; //设置使用的布局文件 方案2:控制器成 ...
- 【转】MFC OnIdle的详细说明
转载出处:http://blog.csdn.net/tsing_best/article/details/25055707 CWinApp::OnIdlevirtual BOOL OnIdle( LO ...
- js和jquery获取父级元素、子级元素、兄弟元素的方法{转}
先说一下JS的获取方法,其要比JQUERY的方法麻烦很多,后面以JQUERY的方法作对比 JS的方法会比JQUERY麻烦很多,主要则是因为FF浏览器,FF浏览器会把你的换行也当成DOM元素 原生的 ...
- Qt 配置文件QSettings读取以及中文问题
QSettings settings("xxxx.ini",QSettings::IniFormat);settings.setIniCodec(QTextCodec::codec ...
- shell学习之路(整理ing)
学习 shell脚本之前的基础知识 http://www.92csz.com/study/linux/12.htm SHELL 脚本 http://www.92csz.com/study/linux/ ...
- C++中获取时间
#include<time.h> //获取时间头文件//-------------------------------------- clock_t start_time=clock ...
- Codeforces Round #364 (Div. 1)B. Connecting Universities
题目链接:传送门 题目大意:n个点构成一棵树,给定 k*2 点,要分成 k 组,使每组点之间的距离之和最大. 题目思路:因为是求距离之和最大,所以我们可以知道这样一个性质.如果以一条边为界,两边的子树 ...
- 基于Web和二维码的文件传输服务
在工作中难免需要对外提供一些我们抓取的log或者操作视频之类的资料,但由于工作环境日渐规范和严格,公司的网络环境和客户的网络环境是被独立开来的.这样做的好处不必多说,但同时也给我们工作带来的诸多不便. ...