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.

Events raised by the WebClient object

pureweb.client.WebClient.EventType.CONNECTED_CHANGED Connection state changes (connecting / connected / disconnected)
pureweb.client.WebClient.EventType.STALLED_CHANGED Fires if the connection stalls, fires again if the connection re-establishes
pureweb.client.WebClient.EventType.SESSION_STATE_CHANGED Fires if collaborators join (including host)
pureweb.client.WebClient.EventType.MULTIPART_HANDLER_EXCEPTION_OCCURRED Fires if the webclient gets a message it doesn't understand

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 Fires when app state is ready to use

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 Fires when name of the view changes ( on the service )
pureweb.client.View.EventType.IS_VIEW_CONNECTED_CHANGED Fires when the view connection state changes (connecting / connected / disconnected)
pureweb.client.View.EventType.VIEW_UPDATED Each time a new view update comes
pureweb.client.View.EventType.VIEW_RESIZED When the view is resized
pureweb.client.View.EventType.MOUSE_EVENT_FIRING Event dispatched before a mouse event is sent to the server to allow individual events to be cancelled.
pureweb.client.View.EventType.KEY_EVENT_FIRING Event dispatched before a key event is sent to the server to allow individual events to be cancelled
pureweb.client.View.EventType.MOUSE_EVENT_QUEUED Event dispatched after a mouse input command is created but before it is transmitted to the service.
pureweb.client.View.EventType.MOUSE_EVENT_RECEIVED Event dispatched when the browser receives a mouse event from user input
pureweb.client.View.EventType.TOUCH_EVENT_RECEIVED Event dispatched when the browser receives a touch event from user input
pureweb.client.View.EventType.KEY_EVENT_QUEUED Event dispatched after a keyboard input command is created but before it is transmitted to the service

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