【发布时间】:2012-12-25 04:07:06
【问题描述】:
我的 dojo 应用程序出现了一个奇怪的问题。它只是关于范围和连接对象本身。以下代码
function(data) {
console.info(this); // [I]
var fun = require(["dojo/Deferred"], function(Deferred) {
console.info(this); // [II]
});
lang.hitch(this, fun());
}
创建这个输出
Object{...} // from [I]
Window index.php [II]
所需的输出必须是对象的 2 倍。我以为我理解了挂接机制,但是通过调用 lang.hitch(this, fun());在我看来,“this”是由 [I] 打印的对象。
希望大家帮忙!
提前致谢!
【问题讨论】:
标签: javascript dojo scope require execution