Export (0) Print
Expand All

WL.Event.subscribe function

WL.Event.subscribe adds a handler to an event in a Windows Store app using JavaScript, or a web app.

Parameters

event

Required. The name of the event to which to add a handler. The Live SDK JavaScript API supports the following events.

NameOccurs whenEvent properties

auth.login

The user completes the sign-in process.

A string with the current status, for example, "connected".

The current session object instance.

auth.logout

The user completes the sign-out process.

None.

auth.sessionChange

The user's access token has changed.

None. Retrieve the current session by calling WL.getSession.

auth.statusChange

The user's status has changed.

None. Retrieve the user's status by calling WL.getLoginStatus.

wl.log

An error has occurred with an API call.

A string with the error message.

 

callback

Required. Specifies the name of the callback function to handle the event.

Return value

This function can return the following errors:

  • WL.Event.subscribe: The input parameter/property 'callback' must be included.
  • WL.Event.subscribe: The input value for parameter/property 'event' is not valid.

Remarks

Note  

When handling the wl.log event, the logging attribute must be set to "true" in the call to WL.init; otherwise, log events will not be fired.

Examples


WL.Event.subscribe("auth.login", onLogin);


Requirements

Library

Wl.js

 

 

Show:
© 2014 Microsoft