diff options
Diffstat (limited to 'test/samples/uscxml/test-postpone-element.scxml')
-rw-r--r-- | test/samples/uscxml/test-postpone-element.scxml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/samples/uscxml/test-postpone-element.scxml b/test/samples/uscxml/test-postpone-element.scxml new file mode 100644 index 0000000..185f367 --- /dev/null +++ b/test/samples/uscxml/test-postpone-element.scxml @@ -0,0 +1,41 @@ +<scxml datamodel="ecmascript" name="postpone"> + <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" /> + <script> + var blocked = true; + </script> + <state id="idle"> + + <!-- request will be postponed until someone unblocks --> + <transition event="http" target="idle" cond="_event.data.pathComponent[1] == 'block'"> + <if cond="blocked"> + <log expr="'Postponing'" /> + <postpone until="blocked == false;" /> + <else> + <response status="200" requestexpr="_event.origin"> + <content expr="blocked" /> + </response> + </else> + </if> + </transition> + + <!-- unblock - this triggers all postponed events --> + <transition event="http" target="idle" cond="_event.data.pathComponent[1] == 'unblock'"> + <log expr="'Unblocking'" /> + <script>blocked = false;</script> + <response status="200" requestexpr="_event.origin"> + <content expr="blocked" /> + </response> + </transition> + + <!-- default --> + <transition event="http" target="idle" cond=" + _event.data.pathComponent[1] != 'unblock' && + _event.data.pathComponent[1] != 'block' + "> + <script>dump(_event);</script> + <response status="200" requestexpr="_event.origin" /> + </transition> + + </state> + <state id="final" final="true" /> +</scxml>
\ No newline at end of file |