diff options
author | No'am Rosenthal <noam.rosenthal@nokia.com> | 2009-11-07 19:16:37 -0800 |
---|---|---|
committer | No'am Rosenthal <noam.rosenthal@nokia.com> | 2009-11-07 19:16:37 -0800 |
commit | c126922b7149396af6fbae170e0730952264390f (patch) | |
tree | 6948972fbe574de9da3216eddd43e98464cdafb7 | |
parent | 8e560f8d6c7b1f0c21182fac6e260af1abd1e0ce (diff) |
Made loading of SCXML asynchronous
-rw-r--r-- | statechartz/statechartz.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/statechartz/statechartz.js b/statechartz/statechartz.js index 56b3acf..73a6248 100644 --- a/statechartz/statechartz.js +++ b/statechartz/statechartz.js @@ -752,11 +752,15 @@ Statechartz = if (rel == "statechart") { var href = link.getAttribute("href"); var xhttp=new XMLHttpRequest(); - xhttp.open("GET",href,false); + xhttp.open("GET",href); + xhttp.onreadystatechange = function() { + if (this.readyState == 4) { + var xmlDoc=this.responseXML; + document.statechart = Statechartz.loadScxml(xmlDoc); + document.statechart.start(); + } + }; xhttp.send(""); - var xmlDoc=xhttp.responseXML; - document.statechart = Statechartz.loadScxml(xmlDoc); - document.statechart.start(); } } } |