diff options
Diffstat (limited to 'src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html')
-rw-r--r-- | src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html b/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html index 2a1de09..6d31b11 100644 --- a/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html +++ b/src/uscxml/plugins/invoker/xhtml/template/xhtml-invoker.html @@ -108,10 +108,17 @@ // use token until we have a context self.cometPoll.open("GET", self.server + (self.query ? "?" + self.query : "")); self.cometPoll.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - self.cometPoll.setRequestHeader("Connection", "close"); + // self.cometPoll.setRequestHeader("Connection", "close"); self.cometPoll.send(null); }; + this.disconnect = function() { + self.xhr.open("POST", self.server + (self.query ? "?" + self.query : ""), false); + self.xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + self.xhr.setRequestHeader('X-SCXML-Name', "done.invoke"); + self.xhr.send(NULL); + }; + this.post = function(name, data, contentType) { self.xhr.open("POST", self.server + (self.query ? "?" + self.query : "")); self.xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); @@ -226,6 +233,11 @@ }); scxml.longpoll(); _parent = scxml; + + window.onbeforeunload = function (e) { + scxml.disconnect(); + // return 'You have unsaved changes!'; + }; }); </script> |