Friday, 5 February 2016

Using dojo.aspect() programatically

dojo.aspect -It  is used to call any DOM Events or user defined functions before/after trigger of actual DOM Event or functions.

This session i will explain the usage of aspect using functions.
aspect has three methods but most of the time we use only two methods those are after() and before().

aspect.before()-To trigger any DOM Event /function before actual target Event/function loading,
aspect.after()-To trigger any DOM Event /function after actual target Event/function loading.

aspect.before(targetNode,"ActualDOMEvent",before/after DOM Events);

Example Code:

<html >
     <title>Dojo Aspect Example</title>
        <link rel="stylesheet" href="" />
<script src=""></script>
    <body class="claro">

require(['dojo/aspect'], function(aspect){

function SuperMethod(){
alert("Super Method called");
console.log("super Method called");
function subMethod(){
alert("Sub Method is called");
console.log("sub method is called");
function helper(){}

//i want to call superMethod first but when i call super method i want to execute my sub method ,so use aspect
//now after calling the sub method i want to call super method