Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home JavaScript
 

CaptureEvents

 

CaptureEvents is a small but powerful function for Ajax and JavaScript. Although not as popular compared to common functions in the client side programming, CaptureEvents can easily change the way developers interact with the application.



As the name suggests, CaptureEvents help developers by logging the events happening within a specified parameter. The function will not have any direct effect on the user but will provide the needed data for developers in improving the application.


The data extracted can also be used for future references within the application depending on the developer's preferences.


Forms of CaptureEvents


There are three forms of CaptureEvents. These are differentiated based on what component in JavaScript or Ajax will capture the said event:


· document.captureEvent


The document within the Ajax and JavaScript based application can log the events as they happen. Though this process might seem easy with an external logger, an external logger might cause lag in the system since the 3rd party logger could be treated as intrusive. This challenge can be dealt with by the function document.captureEvent. With this function, developers will be able to forward the events on the chosen document. This function is lightweight as the document can simply log the information.


· window.captureEvent


Aside from documents, developers can also use the window to capture or log events as they happen. Documents can simply provide information to developers without future interaction. But windows can do much more since the information becomes a data that can be used later in the application. Basically, developers can create additional functions in order to interact with the data provided by the said function. The only challenge is that there are direct methods in implementing the output from another function.


The function, window.captureEvent is better off used on gathering information from various events.


· layer.captureEvent


This form of function is a little bit tricky but can be very useful if the developer opted to extensively use the capture.Event method. The layer.captureEvent is a highly versatile function since it will enable window and document to capture the events as they happen.


The tricky part in this function is that both window and document will capture the same events. This is true if you implement the function in small widgets. Since window and documents will not have any processes to work with, it will concentrate on capturing events and duplication of data which can cause lag in the system.


But the advantage of this function is based on data recovery. Two functions capturing the same event will ensure that the data will never be lost. This also provides additional access to developers. They can use the window function to interact with the application and the document function can help developers log the same event.



Specifying the Event


Developers should imply the type of events that should be captured by window or document. This is imperative for developers since these functions can't just capture every event happening in the application. By indicating a specific event, developers will be assured of easy access with an efficient event capturing tool.



Read Next: Garbage Collection Reference Functions



 
Related Topics


 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links