Classes / Ladybug.FacebookApplication

EXTENDS

Ladybug.Application

OVERVIEW

This class extends the Ladybug.Application class and allows you to create Facebook applications by automatically loading the Facebook SDK for Javascript and notifying you when it has been loaded.

With this, you can create Facebook Tabs and applications that contain Facebook features easily.

The only thing that you should be aware of is that you must override the onFacebookReady callback instead of the OnDomReady one.

Also, you must have a global constants object with an fbAppId property so the SDK knows which app you are going to use with it.

BASIC USAGE

To create your own application object, extend this class and implement at least the OnDomReady method.

var constants = {
    fbAppId: '1234567890'
};
AppSample = Ladybug.FacebookApplication.extend({
    init: function(options) {
        var obj = this;
        // Call parent's constructor
        obj._super(options);
    },
    onFacebookReady: function() {
        var obj = this;
        // Start the router
        obj.router.start();
        // Do Facebook stuff
        FB.getLoginStatus(function(response) {
            // Meh
        });
    }
});

CLASS METHODS

function onFacebookReady()

Callback for the async load of the Facebook SDK, you must use this instead of onDomReady

See Ladybug.Application for inherited class methods.


CLASS MEMBERS

See Ladybug.Application for inherited class members.

Go back to previous page