<source><name>Hemi.monitor</name><project><name>Hemi JavaScript Framework</name><url-title>Hemi JavaScript Framework</url-title><url>/Hemi/</url></project><package><path>Hemi.monitor</path><library>Hemi</library><description>The Monitor service provides a passive client-side monitor framework. Monitors collect and aggregate data per page view and send that data to a server for Web analytics processing.  The Account Manager 4 project includes a reference implementation.</description><static-class><name>service</name><description>Static instance of serviceImpl</description><version>3.1.9</version></static-class><class><name>Monitor</name><description>An object registerer with the <i>ObjectRegistry</i>, that defines an <i>initializeMonitor</i> method, and that may define any <i>handle_{event name}</i> method listed for the MonitorService.  The <i>initializeMonitor</i> method must return true for the object to be treated as a monitor and receive event notifications and intervall callbacks.</description><version>3.1.9</version><example implementation="1"><name>Example Monitor #1</name><description>Demonstrate how to create and register a basic monitor object.</description><code>var oMonitor = {</code><code>   handle_window_load:function(){</code><code>   },</code><code>   // Required by MonitorService</code><code>   initializeMonitor:function(){</code><code>      // must return true for monitoring to be enabled;</code><code>      return 1;</code><code>   }</code><code>};</code><code>// important to prepare object so 1) it can be registered, and 2) add it to the ObjectRegistry</code><code>Hemi.prepareObject("MyMonitor","1.0",true,oMonitor);</code><code>// add the monitor object</code><code>Hemi.monitor.service.addMonitor(oMonitor);</code></example><example><name>Example Monitor #2</name><description>Demonstrate alternate method to create and register a basic monitor object, and include inline configuration for the monitor.</description><code>function Monitor(){</code><code>}</code><code>Monitor.prototype.initializeMonitor = function(){</code><code>   alert("Access configuration value: " + this.getConfigKey("myprop"));</code><code>   // must return true for monitoring to be enabled;</code><code>   return 1;</code><code>}</code><code>var oMonitor = new Monitor();</code><code>// important to prepare object so it can be registered; skip auto-registering for this demonstration.</code><code>Hemi.prepareObject("MyMonitor","1.0",false,oMonitor");</code><code>// Add object to the registry.  It must be registered in order to be added as a monitor.</code><code>Hemi.registry.service.addObject(oMonitor);</code><code><![CDATA[Hemi.monitor.service.addMonitor(oMonitor,"myprop:myval&myprop2:myval2");]]></code></example><example><name>Example Monitor #3</name><description>Demonstrate how to create and register a monitor using an ApplicationComponent.</description><code><![CDATA[<!-- XML Component File -->]]></code><code><![CDATA[<application-components>]]></code><code><![CDATA[   <application-component id = "demo_monitor">]]></code><code><![CDATA[<![]]>CDATA[</code><code>         component_init:function(){</code><code>           Hemi.monitor.service.addMonitor(this);</code><code>         },</code><code>         initializeMonitor:function(){</code><code>            return true;</code><code>         },</code><code>         handle_window_load:function(e){</code><code>            alert("window load via monitor service");</code><code>         }</code><code>      ]]<![CDATA[>]]></code><code><![CDATA[   </application-component>]]></code><code><![CDATA[</application-components>]]></code><code><![CDATA[<!-- HTML Page -->]]></code><code><![CDATA[<script type = "text/javascript">]]></code><code>var oComponent = Hemi.app.comp.newInstance();</code><code>oComponent.loadComponent("demo_monitor","/path/to/file.xml");</code><code><![CDATA[</script>]]></code></example><method><name>getMonitorService</name><description>Returns the MonitorService to which this Monitor is registered.</description><return-value name="m" type="MonitorServiceImpl">A MonitorService implementation.</return-value></method><method><name>getConfigKeys</name><description>Returns the <i>config_keys</i> hash.</description><return-value name="c" type="hash">Returns the hash containing the parsed inline configuration name/value pairs.</return-value></method><method><name>getConfigKey</name><param name="c" type="String">Name of a config key.</param><return-value name="v" type="variant">Returns the String or int value for the corresponding key.</return-value></method><method virtual="1"><name>initializeMonitor</name><return-value type="boolean" name="b">True if the object initialized and should be treated as a monitor, false if the object should be ignored.</return-value><description>Invoked by <i>addMonitor</i> if the object met the basic criteria for participating in the MonitorService: it must be registered, and it must define this method.  Returns true if the object was initialized, false otherwise.  If returning false, the object will not be treated as monitor and receive no notifications or callbacks.   Whether this returns true or false, the object will continue to define the members set when <i>addMonitor</i> was invoked.</description></method><method virtual="1"><name>doInterval</name><description>Invoked by MonitorService <i>doInterval</i>.  By default, this is invoked every one second.  Each monitor can conttrol participating in the interval by setting the <i>can_interval</i> property to true or false, and can increase delay by setting the <i>interval_offset</i> property to the number of whole seconds that should elapse before doInterval is invoked again.  The <i>interval_offset</i> is used as a degrading counter, so each monitor is responsible for setting its own delay after each invocation of doInterval.</description></method><method virtual="1"><name>handle_select_change</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  select change event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_form_submit</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  form submit event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_form_reset</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  form reset event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_window_resize</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  window resize event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_window_keydown</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  window keydown event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_input_blur</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  input blur event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_input_focus</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  input focus event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_window_blur</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  window blur event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_window_focus</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  window focus event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_document_scroll</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  document scroll event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_mouse_move</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  mouse move event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_mouse_click</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  mouse click event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_window_error</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  error event. TODO: need to fix handler parameters. At the moment, error information is not being passed.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_context_menu</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  contextmenu event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_window_unload</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  unload event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_window_beforeunload</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  beforeunload event.</description><param name="e" type="event">Event object raised for this event notification.</param></method><method virtual="1"><name>handle_window_load</name><description>Invoked by MonitorService <i>dispatchEvent</i> to  delegate the  load event and binds elements to internal handlers.  Dispatches <i>window_load</i> to monitors.</description><param name="e" type="event">Event object raised for this event notification.</param></method></class><class><name>MonitorServiceImpl</name><description>A base class for creating beacon and XML transponders for monitoring Web pages.</description><version>3.1.9</version><property type="String" get="1" internal="1"><name>object_id</name><description>Unique instance identifier.</description></property><property type="String" get="1" internal="1"><name>object_version</name><description>Version of the object class.</description></property><property type="String" get="1" internal="1"><name>object_type</name><description>The type of this object.</description></property><property type="int" get="1" internal="1"><name>ready_state</name><description>Object load and execution state.  Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.</description></property><property type="object" get="1" internal="1"><name>object_config</name><description>Object API structure for storing sub structures: object_config.pointers and object_config.status.</description></property><method><name>getObjectId</name><return-value name="i" type="String">The unique object instance id.</return-value><description>Returns the unique id of the object.</description></method><method><name>getObjectType</name><return-value name="t" type="String">The type of the object instance.</return-value><description>Returns the type of the object.</description></method><method><name>getObjectVersion</name><return-value name="v" type="String">The version of the object instance.</return-value><description>Returns the version of the object.</description></method><method><name>getReadyState</name><return-value name="s" type="int">The object ready state.</return-value><description>Returns the state of the object.</description></method><method><name>getStatus</name><return-value name="o" type="object">The object_config.status substructure.</return-value><description>Returns the object_config.status sub structure.</description></method><method><name>getPointers</name><return-value name="o" type="object">The object_config.pointers substructure.</return-value><description>Returns the object_config.pointers sub structure.</description></method><method><name>getContextObject</name><return-value name="d" type="DOMNode">The context node in which monitoring is to take place.</return-value><description>Returns the object in which all monitoring should take place.    Defaults to <i>document</i>.  Can be specified by setting the global <i>CONTEXT_OBJECT</i> variable to a different object prior to loading the MonitorService.</description></method><method><name>getDatasetId</name><return-value name="d" type="String">Identifier representing the type of data being collected.</return-value><description>Returns the identifier used to describe the data being collected.  Defaults to <i>public</i>.  Can be specified by defining the global <i>DATASET_ID</i> variable to a custom value. </description></method><method><name>getDatasetId</name><return-value name="b" type="boolean">Bit indicating whether the document has loaded and, under normal circumstances, whether it is rendered.</return-value><description>Returns true if the document has loaded, false otherwise.</description></method><method><name>getWindowState</name><return-value name="i" type="int">The current state of the browser window.</return-value><description>Returns an int representing the current state of the browser window.  0 = unknown, 1 = uninitialized, 2 = window not loaded, 3 = window loaded, 4 = window before unload, 5 = window unload</description></method><method><name>getSessionId</name><return-value name="s" type="String">String indicating the application session identifier.</return-value><description>Returns the session id based on the pre-configured session cookie name. By default, the MonitorService ships with <i>MONITOR_SESSION_ID</i>, and the value is auto-generated.  To use a different cookie name, the SDK must be used to alter the build configuration.  TODO: Add support for configurable names at runtime.</description></method><method><name>getApplicationId</name><return-value name="s" type="String">String indicating the application identifier.</return-value><description>Returns the application id.  Defaults to <i>Global</i>. Can be specified by defining the global <i>APPLICATION_ID</i> variable to a custom value.</description></method><method><name>getContextId</name><return-value name="s" type="String">Light hash of the current Web page location plus a few random numbers.</return-value><description>Returns a light hash of the current page location plus a few random numbers to uniquely identify the current page visit from other pages visits by this particular session.  This value only has to be unique in relation to other context_ids for the session id.</description></method><method><name>hashCookie</name><param name="n" type="String" optional="1">Name of a specific cookie value to hash and promote its values into the main hash of cookie values.</param><param name="b" type="boolean" optional="1">Bit indicating whether to hash embedded cookie values using the specified value name.</param><param name="f" type="boolean" optional="1">Bit indicating to hash the cookie and ignore whether the cookie was previously hashed.  By default, the cookie may only be hashed once per page view.</param><description><![CDATA[Hashes the document cookies into the <i>cookies</i> hash, where the default cookie structure of most browsers is: <i>name=value; name2=value2</i>.  Optionally hashes embedded cookie values that use the following syntax: <i>subname:subvalue&subname2:subvalue2</i>.  For example: <i>name=subname:subvalue; name2=subname2:subvalue2&subname3:subvalue3</i>]]></description></method><method internal="1"><name>hashValue</name><param name="c" type="String">The value to be hashed (eg: name=value; name2=value2).</param><param name="d" type="String">The delimiter of the value (eg: ;).</param><param name="s" type="String">The name/value assignment operator (eg: =).</param><param name="k" type="object">Object hash into which the retrieved name and value pairs will be applied.</param><description><![CDATA[Hashes the value into the specified hash, using the specified delimiters, such as: <i>name=value; name2=value2</i>.]]></description></method><method private="1" internal="1"><name>doInterval</name><description>A an interval (one second / one thousand milliseconds) that invokes the <i>doInterval</i> method on Monitor instances that set the <i>can_interval</i> property to true.  Monitors can increase delay by setting the <i>interval_offset</i> property to the number of seconds that should elapse before doInterval is invoked again.  The <i>interval_offset</i> is used as a degrading counter, so each monitor is responsible for setting its own delay after each invocation of doInterval.</description></method><method private="1" internal="1"><name>handle_window_interval</name><description>Handler that manages the interval thread.  Note: this doesn't use the ThreadService, though probably should.</description></method><method private="1" internal="1"><name>handle_document_stop</name><description>Handler that manages the stop event.  Dispatches <i>document_stop</i> to monitors.</description></method><method private="1" internal="1"><name>handle_window_load</name><description>Handler that manages the load event and binds elements to internal handlers.  Dispatches <i>window_load</i> to monitors.</description></method><method private="1" internal="1"><name>handle_window_beforeunload</name><description>Handler that manages the beforeunload event.  Dispatches <i>window_beforeunload</i> to monitors.</description></method><method private="1" internal="1"><name>handle_window_unload</name><description>Handler that manages the unload event.  Dispatches <i>window_unload</i> to monitors.</description></method><method private="1" internal="1"><name>dispatchEvent</name><param name="s" type="String">Event key, such is <i>window_load</i> or <i>window_unload</i>.</param><param name="e" type="object">Event object.</param><description>Dispatches event notifications to Monitor instances that define a function named <i>handle_{event key}</i>, such as <i>handle_window_load</i>. The event object is passed as the only parameter. NOTES: should we bother with cancelling events?  These are monitors, which shouldn't be tampering with anything.</description></method><method private="1" internal="1"><name>initializeMonitorService</name><description>Starts the MonitorService.  This is automatically invoke when a MonitorService instance is created.</description></method><method private="1" internal="1"><name>handle_context_menu</name><description>Handler that manages the contextmenu event.  Dispatches <i>context_menu</i> to monitors.</description></method><method private="1" internal="1"><name>handle_window_error</name><description>Handler that manages the error event.  Dispatches <i>window_error</i> to monitors.  TODO: need to fix handler parameters. At the moment, error information is not being passed.</description></method><method private="1" internal="1"><name>handle_mouse_click</name><description>Handler that manages the mouse click event.  Dispatches <i>mouse_click</i> to monitors.</description></method><method private="1" internal="1"><name>handle_mouse_move</name><description>Handler that manages the mouse move event.  Dispatches <i>mouse_move</i> to monitors.</description></method><method private="1" internal="1"><name>handle_document_scroll</name><description>Handler that manages the document scroll event.  Dispatches <i>document_scroll</i> to monitors.</description></method><method private="1" internal="1"><name>handle_window_focus</name><description>Handler that manages the window focus event.  Dispatches <i>window_focus</i> to monitors.</description></method><method private="1" internal="1"><name>handle_window_blur</name><description>Handler that manages the window blur event.  Dispatches <i>window_blur</i> to monitors.</description></method><method private="1" internal="1"><name>handle_input_focus</name><description>Handler that manages the input focus event.  Dispatches <i>input_focus</i> to monitors.</description></method><method private="1" internal="1"><name>handle_input_blur</name><description>Handler that manages the input blur event.  Dispatches <i>input_blur</i> to monitors.</description></method><method private="1" internal="1"><name>handle_window_keydown</name><description>Handler that manages the window keydown event.  Dispatches <i>window_keydown</i> to monitors.</description></method><method private="1" internal="1"><name>handle_window_resize</name><description>Handler that manages the window resize event.  Dispatches <i>window_resize</i> to monitors.</description></method><method private="1" internal="1"><name>handle_form_submit</name><description>Handler that manages the form submit event.  Dispatches <i>form_submit</i> to monitors.</description></method><method private="1" internal="1"><name>handle_form_reset</name><description>Handler that manages the form reset event.  Dispatches <i>form_reset</i> to monitors.</description></method><method private="1" internal="1"><name>handle_select_change</name><description>Handler that manages the select change event.  Dispatches <i>select_change</i> to monitors.</description></method><method private="1" internal="1"><name>bindObjects</name><description>Binds MonitorService event handlers to common browser objects.  Individual monitors participate in the event handler by defining a <i>handle_{event name}</i> function, such as <i>handle_window_load</i>.</description></method>
d.onstop = t.handle_window_stop;
<method private="1" internal="1"><name>bindElements</name><description>Binds MonitorService event handlers to common Web page objects.  Individual monitors participate in the event handler by defining a <i>handle_{event name}</i> function, such as <i>handle_window_load</i>.</description></method>
f(o,"submit",hs);
f(o,"reset",hs);
<method><name>removeMonitor</name><param name="o" type="object">Object registered as a Monitor.</param><return-value name="b" type="boolean">Bit indicating whether the monitor was removed.</return-value><description>Remove an object from the monitor service.</description></method><method><name>addMonitor</name><param name="o" type="object">Object registered with the ObjectRegistry.</param><param name="c" type="String"><![CDATA[Embedded configuration string.  The format of the embedde config string is: name:value&name2:value2.  Use the <i>config_keys</i> hash on the Monitor instance to retrieve individual values.]]></param><description>Adds an object to the monitor service, and allows that object to automatically receive event callbacks and easy access to MonitorService information.  The specified object must define an <i>initializeMonitor</i> method, and the method must return true for the monitor to be added.  Defines the <i>getMonitorService</i> method, <i>can_interval</i>, and <i>interval_offset</i> on the specified object.</description></method></class></package><index><description>The Monitor service provides a passive client-side monitor framework. Monitors collect and aggregate data per page view and send that data to a server for Web analytics processing.  The Account Manager 4 project includes a reference implementation.</description><url>Hemi_api.html</url><url-title>API Index</url-title></index></source>
