extjs中为什么使用“var me = this”?
在ExtJs例子里看到大量“var me = this”,上网找了下,在:http://www.sencha.com/forum/showthread.php?136318-Why-use-quot-var-me-this-quot 找到答案:
Say you have a method in your object A which itself makes an ajax request which has a callback. In this callback you want to use a property "blob" of your original object A. You can not use "this.blob" in this callback because "this" does not refer to your object A anymore (Your scope is in the ajax request). For this reason you save "this" to a variable "me" before you call the function and then refer to "me.blob" to reference the porperty A.blob.
就是说当你用到回调函数的时候是无法使用this的,所以要先用me来保存this指针。
引用:http://hi.baidu.com/antzhi/item/8f5c634dd9a221eda5c06608