facebook-promise
Advanced tools
Comparing version 0.1.1 to 0.1.3
@@ -6,4 +6,10 @@ 'use strict'; | ||
}); | ||
var FBPromise = function FBPromise() { | ||
var FBPromise = function FBPromise(opts) { | ||
return new Promise(function (resolve) { | ||
var _opts$language = opts.language; | ||
var language = _opts$language === undefined ? 'en_US' : _opts$language; | ||
var _opts$debug = opts.debug; | ||
var debug = _opts$debug === undefined ? true : _opts$debug; | ||
if (window.FB && window.FB.init) { | ||
@@ -23,3 +29,3 @@ resolve(window.FB); | ||
js = d.createElement(s);js.id = id; | ||
js.src = '//connect.facebook.net/en_US/sdk.js'; | ||
js.src = '//connect.facebook.net/' + language + '/sdk' + (debug ? '/debug' : null) + '.js'; | ||
fjs.parentNode.insertBefore(js, fjs); | ||
@@ -26,0 +32,0 @@ })(document, 'script', 'facebook-jssdk'); |
{ | ||
"name": "facebook-promise", | ||
"version": "0.1.1", | ||
"version": "0.1.3", | ||
"description": "Loads the Facebook SDK asynchronously and returns it as a Promise.", | ||
@@ -5,0 +5,0 @@ "author": "Glenn Reyes <glenn@glennreyes.com>", |
@@ -1,2 +0,7 @@ | ||
const FBPromise = () => new Promise((resolve) => { | ||
const FBPromise = (opts) => new Promise((resolve) => { | ||
const { | ||
language = 'en_US', | ||
debug = true, | ||
} = opts; | ||
if (window.FB && window.FB.init) { | ||
@@ -16,3 +21,3 @@ resolve(window.FB); | ||
js = d.createElement(s); js.id = id; | ||
js.src = '//connect.facebook.net/en_US/sdk.js'; | ||
js.src = `//connect.facebook.net/${language}/sdk${debug ? '/debug' : null}.js`; | ||
fjs.parentNode.insertBefore(js, fjs); | ||
@@ -19,0 +24,0 @@ })(document, 'script', 'facebook-jssdk'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4579
53