I have a js looks like:
abinit();
function abinit(){}
function hello{var a=12; return a;}
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/* function FrameRequestCallback // callback,// DOMElement Element element){
window.setTimeout(callback, 1000 / 60);
};
})();
AMD converted code looks like below
define(["dojo/ready","dojo/dom","dojo/dom-construct","dojo/_base /fx","dojo/fx","dojo/dom-style","dojo/parser","dojo/window", "dojo/dom-attr","dojo/domReady!"],
function(ready,dom,domConstruct,baseFx,coreFx,domStyle,parser,win,domAttr,) {
var abGlobal = this;
abGlobal.abStatus = false;
return{
abInit:function() { ...... },
hellow:function(){var a=12; return a;}
}
});
Got few questions
how to call init method when i convert it into dojo amd?
how to convert requestAnimFrame according to dojo?
what is the correct approach as per AMD (methods inside return or var ={function abInit()} way?