道场 AMD requestAnimationFrame
dojo AMD requestAnimationFrame
我正在尝试将 Dojo 函数从非 AMD 转换为 AMD,但不确定如何转换以下函数:
以前是非 AMD 类
function step11(timestamp){
window.requestAnimationFrame(step11);
}
转换为 AMD 后
step11: function(timestamp) {
window.requestAnimationFrame(step11);
}
它被其他方法调用为
window.requestAnimationFrame(that.step11);
我试过了:
var that = this;
window.requestAnimationFrame(function() {
that.step11();
});
这给出了错误 "that.step11 is not a function"。
找到解决方案。
define(["dojo/ready", "dojo/dom", "dojo/dom-construct","js/abc", "dojo/domReady!"], function(ready, dom, domConstruct,abc){
var test={
step11: function(timestamp) {
window.requestAnimationFrame(test.step11);
}
};
test.step11();
return test;
});
我正在尝试将 Dojo 函数从非 AMD 转换为 AMD,但不确定如何转换以下函数: 以前是非 AMD 类
function step11(timestamp){
window.requestAnimationFrame(step11);
}
转换为 AMD 后
step11: function(timestamp) {
window.requestAnimationFrame(step11);
}
它被其他方法调用为
window.requestAnimationFrame(that.step11);
我试过了:
var that = this;
window.requestAnimationFrame(function() {
that.step11();
});
这给出了错误 "that.step11 is not a function"。
找到解决方案。
define(["dojo/ready", "dojo/dom", "dojo/dom-construct","js/abc", "dojo/domReady!"], function(ready, dom, domConstruct,abc){
var test={
step11: function(timestamp) {
window.requestAnimationFrame(test.step11);
}
};
test.step11();
return test;
});