Skip to content

Commit b318ce3

Browse files
committed
Merge remote-tracking branch 'origin/vupirov/modules' into modules
2 parents dc05f09 + fe6c80c commit b318ce3

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@
8383
"webpack": "^3.5.5"
8484
},
8585
"dependencies": {
86-
"backendless-request": "^0.0.8"
86+
"backendless-request": "^0.0.9"
8787
}
8888
}

src/users/social/facebook.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Async from '../../request/async'
2+
import Utils from '../../utils'
23

34
import { loginSocial } from './login'
45
import { sendSocialLoginRequest } from './request'
@@ -8,6 +9,8 @@ export const loginWithFacebook = (fieldsMapping, permissions, stayLoggedIn, asyn
89
}
910

1011
export const loginWithFacebookSdk = (fieldsMapping, stayLoggedIn, options) => {
12+
Utils.checkPromiseSupport()
13+
1114
return new Promise((resolve, reject) => {
1215
if (!FB) {
1316
return reject(new Error('Facebook SDK not found'))

src/users/social/google.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Async from '../../request/async'
2+
import Utils from '../../utils'
23

34
import { loginSocial } from './login'
45
import { sendSocialLoginRequest } from './request'
@@ -8,6 +9,8 @@ export const loginWithGooglePlus = (fieldsMapping, permissions, container, stayL
89
}
910

1011
export const loginWithGooglePlusSdk = (fieldsMapping, stayLoggedIn) => {
12+
Utils.checkPromiseSupport()
13+
1114
return new Promise((resolve, reject) => {
1215
if (!gapi) {
1316
return reject(new Error('Google Plus SDK not found'))

src/utils.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ const Utils = {
150150

151151
promisified(method) {
152152
return function() {
153+
Utils.checkPromiseSupport()
154+
153155
const args = [].slice.call(arguments)
154156
const context = this
155157
const fn = typeof method === 'function' ? method : context[method]
@@ -170,6 +172,15 @@ const Utils = {
170172

171173
return fn.apply(context, arguments)
172174
}
175+
},
176+
177+
checkPromiseSupport() {
178+
if (typeof Promise === 'undefined') {
179+
throw new Error(
180+
'This browser doesn\'t support Promise API. Please use polyfill.\n' +
181+
'More info is in the Backendless JS-SDK docs: https://backendless.com/docs/js/doc.html#sync-and-async-calls'
182+
)
183+
}
173184
}
174185
}
175186

0 commit comments

Comments
 (0)