Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ local.properties
.classpath
.settings/
.loadpath
.idea/

# External tool builders
.externalToolBuilders/
Expand Down
85 changes: 46 additions & 39 deletions dist/angular-facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,48 +469,55 @@
delete(settings['loadSDK']); // Remove loadSDK from settings since this isn't part from Facebook API.

/**
* Define fbAsyncInit required by Facebook API
*/
$window.fbAsyncInit = function() {
// Initialize our Facebook app
$timeout(function() {
if (!settings.appId) {
throw 'Missing appId setting.';
}

FB.init(settings);

flags.ready = true;

/**
* Subscribe to Facebook API events and broadcast through app.
*/
angular.forEach({
'auth.login': 'login',
'auth.logout': 'logout',
'auth.prompt': 'prompt',
'auth.sessionChange': 'sessionChange',
'auth.statusChange': 'statusChange',
'auth.authResponseChange': 'authResponseChange',
'xfbml.render': 'xfbmlRender',
'edge.create': 'like',
'edge.remove': 'unlike',
'comment.create': 'comment',
'comment.remove': 'uncomment'
}, function(mapped, name) {
FB.Event.subscribe(name, function(response) {
$timeout(function() {
$rootScope.$broadcast('Facebook:' + mapped, response);
});
* Define fbAsyncInit required by Facebook API
*/
function init() {
// Initialize our Facebook app
$timeout(function() {
if (!settings.appId) {
throw 'Missing appId setting.';
}

FB.init(settings);

// Set ready global flag
flags.ready = true;

/**
* Subscribe to Facebook API events and broadcast through app.
*/
angular.forEach({
'auth.login': 'login',
'auth.logout': 'logout',
'auth.prompt': 'prompt',
'auth.sessionChange': 'sessionChange',
'auth.statusChange': 'statusChange',
'auth.authResponseChange': 'authResponseChange',
'xfbml.render': 'xfbmlRender',
'edge.create': 'like',
'edge.remove': 'unlike',
'comment.create': 'comment',
'comment.remove': 'uncomment'
}, function(mapped, name) {
FB.Event.subscribe(name, function(response) {
$timeout(function() {
$rootScope.$broadcast('Facebook:' + mapped, response);
});
});
});
});

// Broadcast Facebook:load event
$rootScope.$broadcast('Facebook:load');
// Broadcast Facebook:load event
$rootScope.$broadcast('Facebook:load');

loadDeferred.resolve(FB);
});
};
loadDeferred.resolve(FB);
});
}
// Check if FB SDK has already loaded
if(typeof $window.FB !== 'undefined') {
init();
} else {
$window.fbAsyncInit = init;
}

/**
* Inject Facebook root element in DOM
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-facebook.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 46 additions & 39 deletions lib/angular-facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,48 +469,55 @@
delete(settings['loadSDK']); // Remove loadSDK from settings since this isn't part from Facebook API.

/**
* Define fbAsyncInit required by Facebook API
*/
$window.fbAsyncInit = function() {
// Initialize our Facebook app
$timeout(function() {
if (!settings.appId) {
throw 'Missing appId setting.';
}

FB.init(settings);

flags.ready = true;

/**
* Subscribe to Facebook API events and broadcast through app.
*/
angular.forEach({
'auth.login': 'login',
'auth.logout': 'logout',
'auth.prompt': 'prompt',
'auth.sessionChange': 'sessionChange',
'auth.statusChange': 'statusChange',
'auth.authResponseChange': 'authResponseChange',
'xfbml.render': 'xfbmlRender',
'edge.create': 'like',
'edge.remove': 'unlike',
'comment.create': 'comment',
'comment.remove': 'uncomment'
}, function(mapped, name) {
FB.Event.subscribe(name, function(response) {
$timeout(function() {
$rootScope.$broadcast('Facebook:' + mapped, response);
});
* Define fbAsyncInit required by Facebook API
*/
function init() {
// Initialize our Facebook app
$timeout(function() {
if (!settings.appId) {
throw 'Missing appId setting.';
}

FB.init(settings);

// Set ready global flag
flags.ready = true;

/**
* Subscribe to Facebook API events and broadcast through app.
*/
angular.forEach({
'auth.login': 'login',
'auth.logout': 'logout',
'auth.prompt': 'prompt',
'auth.sessionChange': 'sessionChange',
'auth.statusChange': 'statusChange',
'auth.authResponseChange': 'authResponseChange',
'xfbml.render': 'xfbmlRender',
'edge.create': 'like',
'edge.remove': 'unlike',
'comment.create': 'comment',
'comment.remove': 'uncomment'
}, function(mapped, name) {
FB.Event.subscribe(name, function(response) {
$timeout(function() {
$rootScope.$broadcast('Facebook:' + mapped, response);
});
});
});
});

// Broadcast Facebook:load event
$rootScope.$broadcast('Facebook:load');
// Broadcast Facebook:load event
$rootScope.$broadcast('Facebook:load');

loadDeferred.resolve(FB);
});
};
loadDeferred.resolve(FB);
});
}
// Check if FB SDK has already loaded
if(typeof $window.FB !== 'undefined') {
init();
} else {
$window.fbAsyncInit = init;
}

/**
* Inject Facebook root element in DOM
Expand Down