标签:
<script type="text/javascript">
var myFunction = function () {
alert(this.foo);
};
var obj = {foo:"hello"};
var boundFuc = dojo.hitch(obj, myFunction);
myFunction();
boundFuc();
myFunction();
</script>
var myObject = { foo: "bar", myHandler: function (evt) { // this is very contrived but will do. alert("The value of ‘foo‘ is " + this.foo); } }; // later on in the script: dojo.query("#myNodes").forEach(function (node) { node.onclick = myObject.myHandler; });
http://dojotoolkit.org/documentation/tutorials/1.10/hitch/index.html
标签:
原文地址:http://www.cnblogs.com/myboke/p/4629224.html