Dojo Official Translator Dojo/aspect

Source: Internet
Author: User

Website address: http://dojotoolkit.org/reference-guide/1.10/dojo/aspect.html

After ()

Definition:after(target, methodName, advisingfunction, receivearguments);

Meaning: Executes the Advisingfunction method after the target's MethodName method.

function (aspect) {  function(deferred) {    // This was called after any dojo.xhr call  });   // This would execute the original Dojo.xhr method and then our advising function  DOJO.XHR ("GET", {...} );
Dojo.require ("Dojo.aspect"function(response) {  ...});
Before ()

Definition:before(target, methodName, advisingfunction);

Meaning: Execute adviseingfunction before Target's MethodName method.

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 stringArgs.url + = "? X-method=put"; //return the new args      return["POST", args];  }  }); //This would execute the original our advising function and then DOJO.XHRDOJO.XHR ("PUT", {...});});
Around ()

Definition: around (target Methodnameadvisingfactory);

function (aspect) {  function(ORIGINALXHR) {    returnfunction( method, args) {      //  doing something before the originalcall      var deferred = Originalxhr (method, args);       // doing something after the original      call return deferred;    }  });  DOJO.XHR ("PUT", {...} );

Dojo official translation Dojo/aspect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.