.peerbind( eventType, [eventData], handler(eventObject)) Returns: jQuery
Registers the event for broadcast and attaches a handler for received events for the elements.
.peerbind( eventType, [eventData], handler(eventObject))
eventType A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
eventData A map of data that will be passed to the event handler.
handler(eventObject) A function to execute each time the event is triggered.
.peerbind( eventType, [eventData], handlerObject)
eventType A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
eventData A map of data that will be passed to the event handler.
handlerObject A map containing functions for "local" and "peer" events and an optional "data" object that will be passed to the handlers.
* For more information on the underlying "bind" function provided by jQuery see: http://api.jquery.com/bind/
.peertrigger( eventType, [eventData], peerTarget) Returns: jQuery
Execute all handlers and behaviors attached to the matched elements for the given event type.
.peertrigger( eventType, [eventData], peerTarget)
eventType A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
eventData A map of data that will be passed to the event handler.
peerTarget optional guid of peer who should receive the event.
* For more information on the underlying "trigger" function provided by jQuery see: http://api.jquery.com/trigger/
.peerregister( callback ) Returns: jQuery
This function will ensure "callback" is executed when peerbind has successfully registered with the server. This function also allows the client to re-register with the server. (Userful when the peerset has changed.)
.peerregister( callback )
callback Function to be called when peerbind has successfully registered with the server.
.peerbundle( config ) Returns: jQuery
This function configures a peerbundle. This will bundle up multiple events into a small number of messages, and replay them, optionally retaining timeing information.
.peerbundle( config )
config An Object containing the configuration for the peerbundle. Most parameters are optional. The parameters are:
startevent A string containing one or more JavaScript event types, such as "mousedown" or custom event names.
The bundle will start when a startevent is received. If startevent is omitted, the bundle will start when the first event specified by the event parameter is received.
event A string containing one or more JavaScript event types, such as "mousemove" or custom event names.
The bundle will collect these events after a startevent is received until an endevent is received.
endevent A string containing one or more JavaScript event types, such as "mouseup" or custom event names.
After a startevent is received, the bundle will collect events until an endevent is received.
At that time, the bundle will be sent and closed.
startsel An optional jQuery selector for the elements on which startevent is bound.
If omitted, the selector to which peerbundle was passed is used.
eventsel An optional jQuery selector for the elements on which event is bound.
If omitted, the selector to which peerbundle was passed is used.
endsel An optional jQuery selector for the elements on which endevent is bound.
If omitted, the selector to which peerbundle was passed is used. When using bundles with mouse events, it is often useful to set
endsel to $("body"), to ensure that the mouseup is caught even if it occurs outside the initial element.
sendtime An optional timeout before sending the bundle, even if the endevent is not received.
For example, if set to 100, the bundle messages will be sent every 100 ms, as long as at least one event was received.
If omitted, the bundle will not be sent until the endevent is received.
collapsetime An optional time during which events are discarded.
For example, if set to 25, any event occurring within 25 seconds of the previous bundled event will be discarded.
If omiited, all events are sent. The startevent and endevent are always sent.
timing If true (default), events are timestamped, and the receiver uses timeouts to
attempt to replay the events using the same timing that was originally used. If omitted or false, the events
are replayed immediately upon receipt. Note that the value of timing at the sender controls this behavior.
Because of the asynhronous nature of JavaScript and due to network delays, accurate replay of timing is not guaranteed.