Skip to content

Commit

Permalink
added domain property
Browse files Browse the repository at this point in the history
  • Loading branch information
seeden committed Sep 12, 2016
1 parent 75a254e commit dacc448
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function api(path, method, params, callback) {

export default class Facebook {
constructor(options = {}) {
this.domain = options.domain || 'connect.facebook.net';
this._appID = options.appID || null;
this._version = options.version || 'v2.5';
this._cookie = options.cookie || false;
Expand Down Expand Up @@ -76,7 +77,7 @@ export default class Facebook {

const js = document.createElement('script');
js.id = 'facebook-jssdk';
js.src = `//connect.facebook.net/${this._language}/sdk.js`;
js.src = `//${this.domain}/${this._language}/sdk.js`;

fjs.parentNode.insertBefore(js, fjs);
}
Expand Down
3 changes: 3 additions & 0 deletions src/FacebookProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ let facebookInstance = null;

export default class Facebook extends Component {
static propTypes = {
domain: PropTypes.string,
appID: PropTypes.string.isRequired,
version: PropTypes.string.isRequired,
cookie: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -39,6 +40,7 @@ export default class Facebook extends Component {

whenReady(callback) {
const {
domain,
version,
appID,
cookie,
Expand All @@ -51,6 +53,7 @@ export default class Facebook extends Component {

if (!this.facebook) {
this.facebook = facebookInstance = facebookInstance || new FB({
domain,
appID,
version,
cookie,
Expand Down

0 comments on commit dacc448

Please sign in to comment.