Fires a custom event.
Syntax –
Behavior.fireEvent(sEvent[, oEvent])
Example –
The following partial script component is derived from a calculator script component sample. Whenever the result changes, the script component fires a custom onResultChange event back to the page, passing the result as an expando property of the event object.
- <component>
- <public>
- <event name="onResultChange" />
- </public>
- <implements type="Behavior">
- <attach event="onclick" handler="doCalc");
- </implements>
- <script language="JScript">
- <![CDATA[
- function doCalc(){
- // Code here to perform calculation. Results are placed into
- // the variable sResult.
- oEvent = createObjectEvent();
- oEvent.result = sResult;
- fireEvent("onResultChange",oEvent);
- }
- ]]>
- </script>
- </component>