Read the statement by Michael Teeuw here.
module develop help!
-
@wireshark I didn’t look inside deeply.
But ingetDom()
didn’t you draw anything. You just try to alert something on success.
Ok, maybe you are just in developing stage. It’s ok.
So, You should invokegetDom()
withupdateDom()
when it is needed.
By example, in yourstart()
, you can update your dom like this.start: function() { var self = this setInterval(function(){ self.updateDom() }, 60*1000) },
After loaded, this module function
start()
would set interval timer to executeupdateDom()
for refreshing view. every time whenupdateDom()
is called,getDom()
will be executed. So, yourgetDom()
will be executed every 60*1000 milsec. -
But this is not so good, because,
start()
could be executed before DOM created. This could give your module unintended errors. My recommendation is starting your job afterDOM_OBJECTS_CREATED
notification received. This notification would be fired when all modules are loaded and draw their first DOM view.notificationReceived: function(noti, payload, sender) { if (noti == "DOM_OBJECTS_CREATED") { //do your job // e.g) set Timer to refreshing data and update view with updateDom() } },
-
And the last, you SHOULD DRAW YOUR DOM for real rendering.
getDom: function() { // do your job... yourDOM = document.createElement("div") yourDOM.innerHTML = "Something" return yourDOM // DOM which has your content inside, should be returned. },
-
This post is deleted! -
@wireshark
Run withnpm start dev
. And see the logs and errors. They tell you what are real problems. And even for us, without exact information, we couldn’t help.
Anyway, what it means ‘doesn’t work’? It has errors? Black screen?
I think if it works, just alert window would be popped up. (Return value ofxhr.send()
might be not what you really want.) You’d better to investigate codes aroundalert()
. -
This post is deleted! -
Did you ever get your module to work?