Skip to content

Commit

Permalink
Updated angular-facebook.js
Browse files Browse the repository at this point in the history
Added Provider options get and set methods for new api init options:
authResponse, frictionlessRequests, hideFlashCallback.

Added Provider setInitCustomOption to set arbitrary init options as
desired.

Added getInitOption to retrieve init options as needed.
  • Loading branch information
luiscarlosjayk committed Oct 26, 2013
1 parent 96d74cb commit d6f4032
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions lib/angular-facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,72 @@ provides: [facebook]
return settings.xfbml;
};

/**
* Auth Response
* @type {Object}
*/
settings.authResponse = true;

this.setAuthResponse = function(obj) {
obj = obj || true;
settings.authResponse = obj;
};

this.getAuthResponse = function() {
return settings.authResponse;
};

/**
* Frictionless Requests
* @type {Boolean}
*/
settings.frictionlessRequests = false;

this.setFrictionlessRequests = function(enable) {
settings.frictionlessRequests = enable;
};

this.getFrictionlessRequests = function() {
return settings.frictionlessRequests;
};

/**
* HideFlashCallback
* @type {Object}
*/
settings.hideFlashCallback = null;

this.setHideFlashCallback = function(obj) {
obj = obj || null;
settings.hideFlashCallback = obj;
};

this.getHideFlashCallback = function() {
return settings.hideFlashCallback;
};

/**
* Custom option setting
* optionName @type {String}
* value @type {*}
*/
this.setInitCustomOption = function(optionName, value) {
if (!angular.isString(optionName))
return;

settings[optionName] = value;
};

this.getInitOption = function(optionName) {
if (!angular.isString(optionName)) // If optionName is not String then return
return;

if (!settings.hasOwnProperty[optionName]) // If non existing optionName then return
return;

return settings[optionName];
};

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

0 comments on commit d6f4032

Please sign in to comment.