This utility method allows you to wait for a service to finish its initialization process before using it. When the required service is ready to be used the callback function is executed. If the service is already ready when you call the waitForService method, then the callback is executed immediately.
Use this method as a wrap-around the service usage, for example:
Using Facebook JS SDK
In order to use the Facebook JS SDK the following requirements must be fulfilled:
- Define a CNAME entry in your DNS server: specify a new subdomain in your site and point it to socialize.gigya.com.
- In the Gigya's Site setup page, make sure to configure a domain alias (CNAME) and in Gigya's Permissions page, enable Native SDK.
- Open an external application in Facebook. When configuring the external application make sure to follow the instructions for sites using a domain alias, namely, paste your CNAME subdomain instead of socialize.gigya.com in all the places that require a callback URL.
In your page, when loading gigya.js, make sure to pass your APIKey as a parameter (read more in Gigya Basics):
- Use the socialize.waitForService method, to ensure that the Facebook service is ready to be used (see the code sample below).
The following table lists the available parameters:
|||service||string||The service for which to wait. Currently only "facebook" is supported for use with this parameter.|
|||callback||function||A reference to a callback function. Gigya calls the specified function along with the response when the requested service is ready to be used. If the service is already ready when you call the API method, then the callback is executed immediately.|
The callback function should be defined with the following signature: functionName(response)
The "Response object Data Members" table below provides specification of the data that is passed to the callback function.
A developer-created object that is passed back unchanged to the application as one of the fields in the response object.
Response Object Data Members
Triggered Global Events
See Events for more infromation.
facebookLoaded Event Data
|eventName||string||The name of the event: 'facebookLoaded'.|
|isLoggedIn||Boolean||Specifies whether the user is logged in.|
|isConnected||Boolean||Specifies whether the user is connected.|