官网地址: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的更多相关文章

  1. dojo 官方翻译 dojo/_base/lang 版本1.10

    官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/_base/lang.html#dojo-base-lang 应用加载声明: require ...

  2. dojo 官方翻译 dojo/_base/array 版本1.10

    官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/_base/array.html#dojo-base-array array模块dojo进行 ...

  3. dojo 官方翻译 dojo/domReady 版本1.10

    官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/domReady.html#dojo-domready dom加载完成后,执行. requi ...

  4. dojo 官方翻译 dojo/json 版本1.10

    官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/json.html#dojo-json require(["dojo/json&q ...

  5. dojo 官方翻译 dojo/string 版本1.10

    官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/string.html#dojo-string require(["dojo/st ...

  6. dojo 官方翻译 dojo/Deferred

    延迟,异步调用 官网地址:http://dojotoolkit.org/reference-guide/1.9/dojo/Deferred.html require(["dojo/Defer ...

  7. DOJO官方API翻译或解读-dojo/store (自定制存储器)

    dojo/store 是对已存数据的访问和存储的统一接口,dojo/store意图以一个简单.易于使用和扩展的API来,替代.集合和改善 dojo/data 和dojox/storage .基于HTM ...

  8. Events with Dojo(翻译)

    In this tutorial, we will be exploring dojo/on and how Dojo makes it easy to connect to DOM events. ...

  9. 现代DOJO(翻译)

    http://dojotoolkit.org/documentation/tutorials/1.10/modern_dojo/index.html 你可能已经不用doio一段时间了,或者你一直想保持 ...

随机推荐

  1. Access 是/否 字段

    Microsoft Access 数据库引擎 SQL 数据类型包含由 Microsoft® Jet 数据库引擎定义的 13 种主要数据类型,以及若干可识别为这些数据类型的有效同义词. 其中,在工作中遇 ...

  2. Ruby on Rails 初次冲浪体验

    为了更好的阅读体验,欢迎訪问 作者博客原文 Rails is a web application development framework written in the Ruby language. ...

  3. IOS开发之 -- 线程初识

    对于开发者来说,多线程永远有这一层神秘的色彩,似乎是一到迈步过去的坎,在同步.异步.串行.并行.死锁这几个名字当中,逐渐的放弃治疗,下面就多线程,谈一下自己的认识,理解的肯定不全面,只是一些简单的皮毛 ...

  4. IOS学习笔记28—SQLite3第三方库之FMDB

    本文转载至 http://blog.csdn.net/happyrabbit456/article/details/11609451 SQLite是一种小型的轻量级的关系型数据库,在移动设备上使用是非 ...

  5. Linux shell 脚本中, $@ 和$# 分别是什么意思?

    转自:https://zhidao.baidu.com/question/412833470.html $@:表示所有脚本参数的内容 $#:表示返回所有脚本参数的个数. 示例:编写如下shell脚本, ...

  6. 160627、你想知道的关于JavaScript作用域的一切

    JavaScript中有许多章节是关于scope的,但是对于初学者来说(甚至是一些有经验的JavaScript开发者),这些有关作用域的章节既不直接也不容易理解. 这篇文章的目的就是为了帮助那些想更深 ...

  7. Java获取当前服务器IP

    package hope.ipaddress.demo; import java.net.InetAddress; import java.net.NetworkInterface; import j ...

  8. Powershell ——findstr

    从文件中找出关键字 $colItems = Get-ChildItem d:\test #定义文件夹的路径 foreach ($i in $colItems) #循环获取文件夹下的txt文件 { $f ...

  9. FineUI 获取x_state并解析

    public JObject PostBackStates() { JObject xState = null; if (Page.IsPostBack) { string state = HttpC ...

  10. Spring MVC 框架结构介绍(二)

    Spring MVC框架结构 Spring MVC是围绕DispatcherServlet设计的,DispatcherServlet向处理程序分发各种请求.处理程序默认基于@Controller和@R ...