An important note on ending events
Written by: webDOMinator 1 year and 7 months ago
Many times users will only want an event to run once when the event's condition is met. There are two ways to make sure this happen: killing the event, and "ending" it by taking away it's condition. If you kill the event, it's no longer actually there. It's like deleting the event listener. If you simply "end" the event, what you're doing is removing the actual conditions which caused the event to fire.
The best way to create an event and make the resulting script only run once is to remove the condition that caused the event to fire. For instance, if I create an event by running this line of code...
Code
eventQuick Reference for "event"
Click on command to see examples & comments
Events and Event Variables
Usage: event:handle:script-file;condition
Description: Creates an event. An event is something that waits for a condition to be met and then runs the script specified by script-file. The events engine checks the conditions for each declared event every second. Anything can be used for the condition including browser elements, program variables and shared variables.:my
eventQuick Reference for "event"
Click on command to see examples & comments
Events and Event Variables
Usage: event:handle:script-file;condition
Description: Creates an event. An event is something that waits for a condition to be met and then runs the script specified by script-file. The events engine checks the conditions for each declared event every second. Anything can be used for the condition including browser elements, program variables and shared variables.:sys.scriptdir^textbox.qa:madman<in>dom.body.1.innerhtml
And the script for "textbox.qa" is...
Code
dom.body.1.innerhtml=<textarea rows=50 cols=80></textarea>
You can see that I'm using dom.body.1.innerhtml for both the condition of the event and also in the script that the event fires. This means that if I type the text "madman" into some place inside the webDOM browser, it will cause the "myevent" event to fire and it will run my script. In my script, it replaces the entire body of the page with a big textarea text box. This removes my condition and ends the event. If I type "madman" into the big text box at any point in time, it will thus fire the event again, almost looping.