Useful PureWeb events

Various objects within the PureWeb APIs automatically raise events, usually due to status changes within these objects.

Below is a list of the most common of these events on the client side.

Events raised by the WebClient object

(pureweb.client.WebClient.EventType.)

  • CONNECTED_CHANGED: When connection state changes (connecting / connected / disconnected)
  • STALLED_CHANGED: If the connection stalls, fires again if the connection re-establishes
  • SESSION_STATE_CHANGED: If collaborators join (including host)
  • MULTIPART_HANDLER_EXCEPTION_OCCURRED: If the webclient gets a message it doesn't understand
Example

pureweb.listen(pureweb.getClient()
pureweb.client.WebClient.EventType.CONNECTED_CHANGED, myApp.onConnectionChanged);

Events raised by the Framework object()

(pureweb.client.Framework.EventType)<

  • IS_STATE_INITIALIZED: When app state is ready to use
Example

pureweb.listen(pureweb.getFramework()
pureweb.client.Framework.EventType.IS_STATE_INITIALIZED, myApp.onIsStateInitializedChanged);

Events raised by the View object

(pureweb.client.View.EventType)

  • VIEW_NAME_CHANGED: When the name of the view changes ( on the service )
  • IS_VIEW_CONNECTED_CHANGED: When the view connection state changes (connecting / connected / disconnected)
  • VIEW_UPDATED: Each time a new view update comes
  • VIEW_RESIZED: When the view is resized
  • MOUSE_EVENT_FIRING: Before a mouse event is sent to the server to allow individual events to be cancelled.
  • KEY_EVENT_FIRING: Before a key event is sent to the server to allow individual events to be cancelled
  • MOUSE_EVENT_QUEUED: After a mouse input command is created but before it is transmitted to the service.
  • MOUSE_EVENT_RECEIVED: When the browser receives a mouse event from user input
  • TOUCH_EVENT_RECEIVED: When the browser receives a touch event from user input
  • KEY_EVENT_QUEUED: After a keyboard input command is created but before it is transmitted to the service
Example

pureweb.listen(myViewObject,pureweb.client.View.EventType.VIEW_UPDATED, function() 
 {alert('Update');});